Skip to content

Commit

Permalink
Merge pull request #27 from FoamyGuy/isoformat_Z_parse
Browse files Browse the repository at this point in the history
support iso format with Z on end for timezone.
  • Loading branch information
FoamyGuy authored Dec 9, 2024
2 parents 3381501 + 34faebf commit c024272
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions adafruit_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ def __new__(
microsecond: int = 0,
tzinfo: Optional[tzinfo] = None,
*,
fold: int = 0
fold: int = 0,
) -> "time":
_check_time_fields(hour, minute, second, microsecond, fold)
_check_tzinfo_arg(tzinfo)
Expand Down Expand Up @@ -994,6 +994,8 @@ def fromisoformat(cls, time_string: str) -> "time":
Valid format is ``HH[:MM[:SS[.fff[fff]]]][+HH:MM[:SS[.ffffff]]]``
"""
if time_string[-1] == "Z":
time_string = f"{time_string[:-1]}+00:00"
# Store the original string in an error message
original_string = time_string
match = _re.match(r"(.*)[\-\+]", time_string)
Expand Down Expand Up @@ -1254,7 +1256,7 @@ def __new__(
microsecond: int = 0,
tzinfo: Optional[tzinfo] = None,
*,
fold: int = 0
fold: int = 0,
) -> "datetime":
_check_date_fields(year, month, day)
_check_time_fields(hour, minute, second, microsecond, fold)
Expand Down Expand Up @@ -1599,7 +1601,7 @@ def replace(
microsecond: Optional[str] = None,
tzinfo: bool = True,
*,
fold: Optional[int] = None
fold: Optional[int] = None,
) -> "datetime":
"""Return a datetime with the same attributes,
except for those attributes given new values by
Expand Down

0 comments on commit c024272

Please sign in to comment.