Skip to content

Commit

Permalink
fix(book-audible-api): 🩹 throw error if book date is in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
djdembeck committed Dec 2, 2021
1 parent 6161f54 commit ef216dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/helpers/books/audibleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ class ApiHelper {
key = 'issue_date'
}
const releaseDate = new Date(inputJson[key])
// Check that release date isn't in the future
const now = new Date()
if (releaseDate > now) {
throw new Error('Release date is in the future')
}
finalJson.releaseDate = releaseDate
} else {
missingKeyMsg(key)
Expand Down

0 comments on commit ef216dd

Please sign in to comment.