Open
Description
Description
Dates without timezone info are ambiguous (is it local time or UTC ? Only the caller knows).
The ISO 8601 standard is great, but I want to ensure the presence of a timezone when validating my dates.
Proposed solution
I would like for isDateString (and IsDateString) to have an option "includeTimezone" (default to false) to ensure that a timezone is present in the string.
isDateString("2025-01-01 00:00:00", { includeTimezone: true }) // false
isDateString("2025-01-01 00:00:00Z", { includeTimezone: true }) // true
isDateString("2025-01-01 00:00:00+01:00", { includeTimezone: true }) // true
I understand that isDateString is an alias for isISO8601 from the package validator, maybe I should post this feature request to validator instead of here ?