aboutsummaryrefslogtreecommitdiff
path: root/src/lib/server/services/routines.ts
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-09-08 17:06:51 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-09-08 17:06:51 +0200
commitbd2f982c489b15ce1165c051fdedf35af979f784 (patch)
tree5c76d07f94b34f6b7b31be6a133793b2cdaccd79 /src/lib/server/services/routines.ts
parent6d69c7b1e6a8051338e052cc9d1836f4f1a20f51 (diff)
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.
Diffstat (limited to 'src/lib/server/services/routines.ts')
-rw-r--r--src/lib/server/services/routines.ts12
1 files changed, 8 insertions, 4 deletions
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<void> {
...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<ProjectDashboard> {
const versions = await db
@@ -249,7 +253,7 @@ export interface ProjectsOverview {
}
export async function loadOverview(
- now: number,
+ now: Temporal.Instant,
db = defaultDb,
): Promise<ProjectsOverview> {
const activeProjects = await db