From bd2f982c489b15ce1165c051fdedf35af979f784 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Tue, 8 Sep 2026 17:06:51 +0200 Subject: Migrate date handling from Date to Temporal API Routine scheduling, health series, service stamps, session expiry, and date formatting move to native Temporal (Instant / ZonedDateTime in UTC), with ISO strings kept at DB and chart boundaries. Ambient types in src/temporal-ambient.d.ts cover the native runtime; no polyfill. Observable behavior and stored formats are unchanged. --- src/lib/server/services/routines.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/lib/server/services/routines.ts') diff --git a/src/lib/server/services/routines.ts b/src/lib/server/services/routines.ts index ec03c50..a29872a 100644 --- a/src/lib/server/services/routines.ts +++ b/src/lib/server/services/routines.ts @@ -36,7 +36,9 @@ export async function add( projectId, name, frequencyDays, - createdAt: new Date().toISOString(), + createdAt: Temporal.Now.instant().toString({ + smallestUnit: 'millisecond', + }), }) .returning(); return inserted; @@ -91,7 +93,9 @@ export async function archive(id: number, db = defaultDb): Promise { ...current, version: current.version + 1, archived: true, - archivedAt: new Date().toISOString(), + archivedAt: Temporal.Now.instant().toString({ + smallestUnit: 'millisecond', + }), }); } @@ -206,7 +210,7 @@ export interface ProjectDashboard { export async function loadProjectDashboard( projectId: number, - now: number, + now: Temporal.Instant, db = defaultDb, ): Promise { const versions = await db @@ -249,7 +253,7 @@ export interface ProjectsOverview { } export async function loadOverview( - now: number, + now: Temporal.Instant, db = defaultDb, ): Promise { const activeProjects = await db -- cgit v1.3