Skip to content

Commit

Permalink
fix: fromisoformat doesn't accept Z (closes #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
metaist committed Sep 18, 2024
1 parent d9226d7 commit b67c668
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cosmofy/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def update(self, **values: str) -> Receipt:
"""Update this receipt with several values."""
for name, value in values.items():
if name == "date":
self.date = datetime.fromisoformat(value)
self.date = datetime.fromisoformat(value.replace("Z", "+00:00"))
else:
setattr(self, name, value)
return self
Expand All @@ -211,7 +211,7 @@ def from_dict(data: Dict[str, str]) -> Receipt:

_data = {**data} # copy to prevent modification
schema = _data.pop("$schema")
date = datetime.fromisoformat(_data.pop("date"))
date = datetime.fromisoformat(_data.pop("date").replace("Z", "+00:00"))
kind: RECEIPT_KIND = ( # mypy can't detect this properly
"published" if _data.pop("kind") == "published" else "embedded"
)
Expand Down

0 comments on commit b67c668

Please sign in to comment.