Changed verse change to 2AM EST DST

This commit is contained in:
h202-wq
2026-08-18 19:19:47 -04:00
parent 569d100652
commit d6af254eab
2 changed files with 9 additions and 5 deletions
+7 -3
View File
@@ -24,13 +24,17 @@ export interface Verse {
let flat: Verse[] | null = null
const ROLLOVER_LOCAL_HOUR = 2
export function daySeed(now: Date = new Date()): number {
return Math.floor(now.getTime() / 86_400_000)
const shifted = new Date(now.getTime() - ROLLOVER_LOCAL_HOUR * 3600_000)
return Math.floor(Date.UTC(shifted.getFullYear(), shifted.getMonth(), shifted.getDate()) / 86_400_000)
}
export function msUntilMidnightUtc(now: Date = new Date()): number {
export function msUntilRollover(now: Date = new Date()): number {
const next = new Date(now)
next.setUTCHours(24, 0, 0, 0)
next.setHours(ROLLOVER_LOCAL_HOUR, 0, 0, 0)
if (next.getTime() <= now.getTime()) next.setDate(next.getDate() + 1)
return next.getTime() - now.getTime()
}