Skip to content
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

Fix datetime deserialization #5

Merged
merged 1 commit into from
Oct 24, 2023
Merged

Fix datetime deserialization #5

merged 1 commit into from
Oct 24, 2023

Conversation

vdurmont
Copy link
Contributor

We used to just get the string value from the JSON and store it in the field. Now we properly deserialize it using datetime.fromisoformat.

@vdurmont vdurmont requested a review from jklein24 October 24, 2023 21:15
@@ -284,8 +284,8 @@ def from_json(requester: Requester, obj: Mapping[str, Any]) -> PaymentRequestDat
),
payment_hash=obj["invoice_data_payment_hash"],
amount=CurrencyAmount_from_json(requester, obj["invoice_data_amount"]),
created_at=obj["invoice_data_created_at"],
expires_at=obj["invoice_data_expires_at"],
created_at=datetime.fromisoformat(obj["invoice_data_created_at"]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we may need to import datetime too?

Copy link
Contributor Author

@vdurmont vdurmont Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course! I missed it somehow :)

@vdurmont vdurmont merged commit 5e6714e into main Oct 24, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants