Changed verse change to 2AM EST DST
This commit is contained in:
+7
-3
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user