mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 06:06:10 +00:00
fix(tz): one start-of-day for every zone, including skipped midnights
Local day bounds had three implementations. The day-key one read the zone offset at UTC midnight, which on a transition day in zones far from UTC (Pacific/Auckland, Australia/Sydney) is the offset after the change, so the day started an hour off. The instant one converged on local 00:00, which in zones that skip midnight (America/Santiago, America/Havana) does not exist, and returned 23:00 of the previous day. startOfLocalDayKey and localDayWindow in lib/tz/local-day are now the only implementation: the first instant that reads the day, tried under every offset in force around it. A skipped wall clock resolves to the moment the clocks jump, the day-keyed copies in the measurement drains, the compliance rollups and the dashboard batch window are gone, and the noon and mid-hour anchors use the same converge.
This commit is contained in:
1 parent
e1e664be46
commit
73e0653b2c
14 files changed
+237
-231
No files matched your search
@@ -34,8 +34,8 @@ import { pickCanonicalSourceRows } from "@/lib/analytics/source-priority";
|
||||
import {
|
||||
canonicalDailyTimestamp,
|
||||
dayKeyForUserTz,
|
||||
localDayWindow,
|
||||
} from "@/lib/measurements/drain-per-sample-cumulative";
|
||||
import { localDayWindow } from "@/lib/tz/local-day";
|
||||
import { withIdempotency } from "@/lib/idempotency";
|
||||
import { isP2002 } from "@/lib/prisma-errors";
|
||||
import { encryptNote, shapeMeasurementNotes } from "@/lib/crypto/note-cipher";
|
||||
|
||||
Reference in new issue
Block a user