-
-
Notifications
You must be signed in to change notification settings - Fork 256
Action isoTimestamp
allows space in UTC offset
#1195
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the ISO 8601 timestamp regex to accept a single space before the timezone offset for better compatibility with PostgreSQL’s timestamptz
output.
- Allow an optional space before the UTC offset in
ISO_TIMESTAMP_REGEX
. - Add tests covering timestamps with a space before the offset.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
library/src/regex.ts | Updated ISO_TIMESTAMP_REGEX to accept a leading space before +/- offset. |
library/src/actions/isoTimestamp/isoTimestamp.test.ts | Added a test suite for timestamps with a space before the UTC offset. |
Thank you for creating this PR! Are you aware of any drawbacks? I'm a bit concerned because it doesn't seem to be ISO 8601 compliant. |
Thank you for asking! I agree this tweak isn’t strictly ISO 8601, but I don’t anticipate any serious drawbacks, mainly because it matches common real-world usage. For example, PostgreSQL’s Also, our current In short, this change improves compatibility with real data (avoiding false validation errors on perfectly valid SQL-standard timestamps) while staying aligned with the library’s goal of being practical and developer-friendly. |
1957b1d
to
4abb005
Compare
Sorry for my late reply! I agree but I want to look at other schemas library like Zod first to see how they handle it. For now, I would plan to release this as a "fix" with Valibot v1.2. |
4abb005
to
c45337d
Compare
Fixes:
isoTimestamp
only accepts UTC timestamps #495Changes:
+00:00
).Reason:
timestamptz
default output includes a space before the timezone offset: