Kaizen
Browse modulesStringsFunctions

Function: isValidDateOnly()

function isValidDateOnly(value: string): boolean;

Defined in: shared/strings/date-time.ts:91

Whether the date-only formatters will accept value, i.e. whether it names a real Gregorian YYYY-MM-DD date.

Worth a predicate because new Date cannot answer it: new Date("2026-02-31") overflows to Mar 3 rather than reporting an invalid date, so an isNaN check on the parsed result waves an impossible day through to a formatter that rejects it by throwing. Delegates to the same validator the formatters use, so the two can never disagree — including on rules no round-trip check would find, like the year 0000.

Parameters

ParameterType
valuestring

Returns

boolean

On this page