Skip to content

support iso format with Z on end for timezone. #27

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

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading