Skip to content

Commit

Permalink
fix(hackernews): convert date to ISO8601 string to ensure maximum dat…
Browse files Browse the repository at this point in the history
…e tolerance
  • Loading branch information
aldy505 committed Nov 21, 2023
1 parent 4d55c7a commit e87804f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hackernews.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ for (;;) {

if (now.getUTCHours() >= 11) {
// The next time is 00:00 AM
nextTime = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + 1, 11, 0, 0, 0);
nextTime = new Date(`${now.getUTCFullYear()}-${(now.getUTCMonth() + 1).toString().padStart(2, "0")}-${(now.getUTCDate() + 1).toString().padStart(2, "0")}T00:00:00Z`);
} else if (now.getUTCHours() < 11) {
// The next time is 11:00 AM
nextTime = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 11, 0, 0, 0);
nextTime = new Date(`${now.getUTCFullYear()}-${(now.getUTCMonth() + 1).toString().padStart(2, "0")}-${now.getUTCDate().toString().padStart(2, "0")}T11:00:00Z`);
}

// eslint-disable-next-line no-await-in-loop
Expand Down

0 comments on commit e87804f

Please sign in to comment.