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 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-11-16 20:49:31 -05:00
commit b306e9dea7

View file

@ -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();
}