Skip to content
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

ISO8601 DateTime to Timestamp fails when milliseconds not specified #14

Open
ciozi137 opened this issue Oct 19, 2024 · 3 comments
Open

Comments

@ciozi137
Copy link
Contributor

Conversion fails when milliseconds are not specified in the ISO8601 DateTime String:

OK:
Screenshot 2024-10-19 at 1 21 39 PM

Not OK:
Screenshot 2024-10-19 at 1 21 52 PM

Originally posted by @ciozi137 in #11 (comment)

@ciozi137 ciozi137 changed the title ISO8601 DateTime to Timestamp fail on no milliseconds preseent ISO8601 DateTime to Timestamp fails when milliseconds not specified Oct 19, 2024
@ciozi137
Copy link
Contributor Author

@francois-normandin unfortunately is not working for strict and not strict ISO 8601. And only for 3 (or more?) millisecond digits:
image

@ciozi137
Copy link
Contributor Author

regex:
^([0-9]{4})-?(1[0-2]|0[1-9])-?(3[01]|0[1-9]|[12][0-9])([T])([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{3})(.*)

change to:
^([0-9]{4})-?(1[0-2]|0[1-9])-?(3[01]|0[1-9]|[12][0-9])([T])([0-9]{2}):([0-9]{2}):([0-9]{2})(?:.([0-9]+))?(.*)

captures the millisecond field (or not):
Screenshot 2024-10-20 at 9 58 05 AM
Screenshot 2024-10-20 at 9 58 26 AM

But then the logical OR will be False here:
image

so still needs a little tweaking

@ciozi137
Copy link
Contributor Author

One more thing I noticed: there is no case for time only, which should also be allowed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant