From b306e9dea7b37ffc03224ce8036d76623942f33d Mon Sep 17 00:00:00 2001 From: le king fu Date: Mon, 16 Nov 2026 20:49:31 -0500 Subject: [PATCH] test(web): pin the start anchor of the date-time format (#198) The review of PR #210 removed the `^` of DATE_TIME in dueDate.ts and no test failed: `12026-11-15T09:00:00Z` would then be read as the year 2026 instead of being refused. Two values join the refusal list of parseDueDate, a fifth digit of the year and a space before a date-time: with the anchor removed, 1 of the 242 tests of `npx vitest run` fails; on the code as it is, the 242 pass. Co-Authored-By: Claude Fable 5.2 --- web/src/lib/dueDate.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/src/lib/dueDate.test.ts b/web/src/lib/dueDate.test.ts index f5ec029..e7127d7 100644 --- a/web/src/lib/dueDate.test.ts +++ b/web/src/lib/dueDate.test.ts @@ -102,6 +102,8 @@ describe('parseDueDate', () => { ' 2026-11-15', '2026-11-15 ', '2026-11-15\n', '2026-11-15T09:00:00Z\n', '2026-11-15 09:00:00Z', '2026-11-15t09:00:00z', '2026-11-15T09:00:00+0500', '2026-11-15T09:00:00+05', '2026-11-15T09:00:00.Z', '2026-11-15T09:00.5Z', '+002026-11-15', `${arabicIndicYear}-11-15`, + // Nothing before a date-time either: a fifth digit of the year, a space. + '12026-11-15T09:00:00Z', ' 2026-11-15T09:00:00Z', ]) { expect(parseDueDate(value), JSON.stringify(value)).toBeNull(); }