fix(supabase): refuse a last_modified_at a Date cannot read

The timestamp shape check lets an offset such as +99:99 through, which
Date.parse reads as NaN and the date formatter would throw on. The key
now also requires a readable date, so the case folds into unavailable.
Test added beside the existing refusal test; no assertion changed.
This commit is contained in:
bchanot committed 2026-11-16 17:54:54 +01:00
1 parent 72ec758278
commit 374e300895
2 files changed
+11 -1

No files matched your search

+5 -1
View File
@@ -387,7 +387,11 @@ const OfficialSheetAdminSummarySchema = z.object({
created_at: z.string(),
updated_at: z.string(),
/** The newest of the sheet's and its versions' `updated_at` (M9): what « dernière modification » sorts and shows. */
last_modified_at: z.string().datetime({ offset: true }),
last_modified_at: z
.string()
.datetime({ offset: true })
// The shape alone lets `+99:99` through, which a Date cannot read: fail closed here.
.refine((value) => !Number.isNaN(Date.parse(value))),
name: LocalizedSchema,
historical: z.boolean(),
working_copy: z.boolean(),