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

adafruit_datetime.datetime.fromisoformat() doesn't support datetimes ending with "Z" representing UTC #9642

Closed
skjdghsdjgsdj opened this issue Sep 18, 2024 · 2 comments
Labels

Comments

@skjdghsdjgsdj
Copy link

CircuitPython version

9.1.4

Code/REPL

import adafruit_datetime
print(adafruit_datetime.datetime.fromisoformat("2024-09-18T19:33:00Z"))

Behavior

A ValueError is raised with message "Invalid isoformat string: '2024-09-18T19:33:00Z'"

Description

ISO 8601 says:
"If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "T0930Z". "14:45:15 UTC" would be "14:45:15Z" or "T144515Z"."

I'm calling a REST API that sometimes returns datetimes this way. adafruit_datetime.datetime.fromisoformat() doesn't seem to support them and raises a ValueError.

Additional information

No response

@RetiredWizard
Copy link

I think this is probably a duplicate of adafruit/Adafruit_CircuitPython_datetime#22

@skjdghsdjgsdj
Copy link
Author

I think you're right.

@skjdghsdjgsdj skjdghsdjgsdj closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants