arcanis / typanion

Static and runtime type assertion library with no dependencies
https://mael.dev/typanion/
264 stars 15 forks source link

Feature request: support milliseconds in `isDate` #36

Open sargunv opened 1 year ago

sargunv commented 1 year ago

I'm trying to parse JSON that contains dates that are just like the ISO8601 handled by this library, except they have milliseconds. I get the following error from Typanion:

Expected to be a valid ISO 8601 date string (got "2023-01-06T02:10:20.118Z")

I'd like either the existing isDate or a new function to support the .118 milliseconds part of the string.

ztamas83 commented 1 month ago

@arcanis I created a quick PR, would highly appreciate if a new release could be created with the added regex. It's not complete as per #39, but would help me a lot in an ongoing project.