Skip to content

Support more iso formats like python 11 #22

Closed
@Neradoc

Description

@Neradoc

This library:

>>> from adafruit_datetime import datetime
>>> datetime.fromisoformat('2000-01-01T00:30:27Z')
Traceback (most recent call last):
  File "adafruit_datetime.py", line 1019, in fromisoformat
  File "adafruit_datetime.py", line 985, in _parse_iso_string
ValueError: 

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "adafruit_datetime.py", line 1386, in fromisoformat
  File "adafruit_datetime.py", line 1027, in fromisoformat
ValueError: Invalid isoformat string: '00:30:27Z'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_datetime.py", line 1391, in fromisoformat
ValueError: Invalid isoformat string: '2000-01-01T00:30:27Z'
>>> 

Python 11:

python
Python 3.11.1 (main, Jan  5 2023, 23:03:26) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.fromisoformat("2022-01-01T00:01:00Z")
datetime.datetime(2022, 1, 1, 0, 1, tzinfo=datetime.timezone.utc)
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions