8000 adafruit_datetime.datetime.fromisoformat() doesn't support datetimes ending with "Z" representing UTC · Issue #9642 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
adafruit_datetime.datetime.fromisoformat() doesn't support datetimes ending with "Z" representing UTC #9642
Closed as not planned
@skjdghsdjgsdj

Description

@skjdghsdjgsdj

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0