Fixed timezone bug (same as motus)

This commit is contained in:
Simon Cambier 2022-02-22 22:54:01 +01:00
parent 632351031f
commit 32093281d6

View File

@ -7,7 +7,11 @@ export function getCurrentDate(): Date {
}
export function getCurrentSessionKey(): string {
return getCurrentDate().toISOString().slice(0, 10)
const now = getCurrentDate()
// https://stackoverflow.com/a/28149561
const tzoffset = now.getTimezoneOffset() * 60000
const localISOTime = new Date(now.getTime() - tzoffset).toISOString()
return localISOTime.slice(0, 10)
}
// #region RNG