Skip to content

Commit 9a7297d

Browse files
committed
Fix midnight time setting
1 parent 51d7c68 commit 9a7297d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/components/v1/TimeBasedWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const TimeBasedWrapper = ({ incomingStartDate, incomingEndDate, children }: Prop
3838

3939
// Update the date (day) of the start and end dates so it would run everyday
4040
// Basically we have a timeout to launch after midnight by one second to update the day of the start and end dates
41-
const timeUntilMidnight = new Date(new Date().setHours(0, 0, 0, 0)).getTime() - new Date().getTime() + 1000
41+
const timeUntilMidnight = new Date(new Date().setHours(23, 59, 59, 59)).getTime() - new Date().getTime() + 1000
4242
nextDayUpdateTimeOut = setTimeout(() => {
4343
setStartDate(new Date(startDate.setDate(startDate.getDate() + 1)))
4444
setEndDate(new Date(endDate.setDate(endDate.getDate() + 1)))

src/components/v2/hooks/useTimeBasedRendering.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const useTimeBasedRendering = (incomingStartDate: Date, incomingEndDate:
3535

3636
// Update the date (day) of the start and end dates so it would run everyday
3737
// Basically we have a timeout to launch after midnight by one second to update the day of the start and end dates
38-
const timeUntilMidnight = new Date(new Date().setHours(0, 0, 0, 0)).getTime() - new Date().getTime() + 1000
38+
const timeUntilMidnight = new Date(new Date().setHours(23, 59, 59, 59)).getTime() - new Date().getTime() + 1000
3939
nextDayUpdateTimeOut = setTimeout(() => {
4040
setStartDate(new Date(startDate.setDate(startDate.getDate() + 1)))
4141
setEndDate(new Date(endDate.setDate(endDate.getDate() + 1)))

0 commit comments

Comments
 (0)