aboutsummaryrefslogtreecommitdiff
path: root/src/temporal-ambient.d.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/temporal-ambient.d.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/temporal-ambient.d.ts')
-rw-r--r--src/temporal-ambient.d.ts54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/temporal-ambient.d.ts b/src/temporal-ambient.d.ts
new file mode 100644
index 0000000..f6080b0
--- /dev/null
+++ b/src/temporal-ambient.d.ts
@@ -0,0 +1,54 @@
+// Minimal ambient Temporal declarations (native runtime, no polyfill).
+// Covers only what this app uses; extend as needed. If a future TS lib
+// ships Temporal types, these merge with them.
+
+declare global {
+ namespace Temporal {
+ type TimeZoneId = string;
+ type DurationLike = {
+ days?: number;
+ hours?: number;
+ milliseconds?: number;
+ };
+
+ interface Duration {
+ total(options: { unit: 'millisecond' | 'day' }): number;
+ }
+ namespace Duration {
+ function from(durationLike: DurationLike): Duration;
+ }
+
+ interface Instant {
+ readonly epochMilliseconds: number;
+ add(durationLike: { hours?: number; milliseconds?: number }): Instant;
+ toString(options?: { smallestUnit?: 'millisecond' }): string;
+ toZonedDateTimeISO(timeZone: TimeZoneId): ZonedDateTime;
+ toLocaleString(
+ locales?: string | string[],
+ options?: Intl.DateTimeFormatOptions,
+ ): string;
+ }
+ namespace Instant {
+ function compare(a: string | Instant, b: string | Instant): number;
+ function from(iso: string): Instant;
+ function fromEpochMilliseconds(ms: number): Instant;
+ }
+
+ interface ZonedDateTime {
+ add(durationLike: DurationLike): ZonedDateTime;
+ startOfDay(): ZonedDateTime;
+ toInstant(): Instant;
+ toLocaleString(
+ locales?: string | string[],
+ options?: Intl.DateTimeFormatOptions,
+ ): string;
+ }
+
+ namespace Now {
+ function instant(): Instant;
+ function timeZoneId(): TimeZoneId;
+ }
+ }
+}
+
+export {};