aboutsummaryrefslogtreecommitdiff
path: root/src/lib/server/services/groceries.test.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/groceries.test.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/groceries.test.ts')
-rw-r--r--src/lib/server/services/groceries.test.ts20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/server/services/groceries.test.ts b/src/lib/server/services/groceries.test.ts
index a704b57..4d9aa2f 100644
--- a/src/lib/server/services/groceries.test.ts
+++ b/src/lib/server/services/groceries.test.ts
@@ -18,7 +18,9 @@ describe('groceries service', () => {
});
it('loadUnchecked returns only unchecked items', async () => {
- const now = new Date().toISOString();
+ const now = Temporal.Now.instant().toString({
+ smallestUnit: 'millisecond',
+ });
await db.insert(groceries).values([
{ name: 'milk', checked: false, createdAt: now },
{ name: 'bread', checked: true, createdAt: now },
@@ -30,7 +32,9 @@ describe('groceries service', () => {
});
it('loadAll returns all items', async () => {
- const now = new Date().toISOString();
+ const now = Temporal.Now.instant().toString({
+ smallestUnit: 'millisecond',
+ });
await db.insert(groceries).values([
{ name: 'milk', checked: false, createdAt: now },
{ name: 'bread', checked: true, createdAt: now },
@@ -41,7 +45,9 @@ describe('groceries service', () => {
});
it('toggle flips checked state', async () => {
- const now = new Date().toISOString();
+ const now = Temporal.Now.instant().toString({
+ smallestUnit: 'millisecond',
+ });
await db
.insert(groceries)
.values({ name: 'milk', checked: false, createdAt: now });
@@ -67,7 +73,9 @@ describe('groceries service', () => {
});
it('addOrUncheck unchecks an existing checked item', async () => {
- const now = new Date().toISOString();
+ const now = Temporal.Now.instant().toString({
+ smallestUnit: 'millisecond',
+ });
await db
.insert(groceries)
.values({ name: 'milk', checked: true, createdAt: now });
@@ -83,7 +91,9 @@ describe('groceries service', () => {
});
it('deleteGrocery removes the item', async () => {
- const now = new Date().toISOString();
+ const now = Temporal.Now.instant().toString({
+ smallestUnit: 'millisecond',
+ });
await db
.insert(groceries)
.values({ name: 'milk', checked: false, createdAt: now });