-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
does not work on YYYY-MM-DD #11
Comments
this regex seems a bit more inclusive: const dateRegex = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(?:\.\d*)?(?:[-+]\d{2}:?\d{2}|Z)?)?$/; |
You'll always end up with a solution where you can't guarantee that someone indeed wanted to have '2023-12-31' as a string instead of a date because its for example just a reference to whatever. The root cause is, that the response transformers have no idea about the object declaration they are about to create. So they never will have the chance to check the expected target type of each key but have to guess based on data. This will always lead to produce errors - unfortunately - with user input data. |
To clarify, what @OlliL is referring to is an example where a user chooses to name themself This is indeed a real issue @OlliL . I will made a separate issue to try to address it #12 |
released in v1.10.0 as a minor instead of a patch since existing users would now have date strings converted to date objects |
the regex seems to only match full date strings (YYYY-MM-DDTHH:mm:ss) and not dates (YYYY-MM-DD).
this could lead to breaking changes for users that found this to be expected. That being said, we should add a flag to trea date strings as Date objects.
The text was updated successfully, but these errors were encountered: