-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
isoTimestamp
only accepts UTC timestamps
#495
Comments
Thank you for creating this issue! Do you have a use case for this functionality? Can you share some example code? |
@fabian-hiller, while working with a Rails backend, we get timestamps with offsets like this: The idea was to validate the field using The offset is valuable in some use cases, as it can be used to determine the event's local time without pulling data from other sources (geolocation, etc.). For example, when selling tickets for a concert in the US, just the offset would be enough to show both the event's local time and the user's local time. But this example can be extended to flights, conferences, etc. Considering that it seems to be part of the accepted standard, I think this should be handled by the default regex. |
Thank you for the info! Feel free to create a PR and expand the current regex. |
Should be fixed 🙌 |
It looks like
ISO_TIMESTAMP_REGEX
validates only UTC timestamps (ending withZ
). But the standard also defines the possibility of having offsets.From my understanding, the following formats should all be considered as valid ISO timestamps:
<time>Z
<time>±hh:mm
<time>±hhmm
<time>±hh
If you consider it a bug, I'd happily open a PR 🙂
The text was updated successfully, but these errors were encountered: