open-spaced-repetition / py-fsrs

Python Package for FSRS
https://pypi.org/project/fsrs/
MIT License
147 stars 23 forks source link

v2.0.0 - update cards to be timezone aware #31

Closed joshdavham closed 7 months ago

joshdavham commented 7 months ago

PR to address issue #28

For developers using previous versions of py-fsrs, they can update an old card object by using the following code:

# where card_object is a v1 py-fsrs card...
import datetime
card_object.due = card_object.due.replace(tzinfo=datetime.timezone.utc)
if hasattr(card_object, 'last_review'):
    card_object.last_review = card_object.last_review.replace(tzinfo=datetime.timezone.utc)

Let me know if there are any questions or issues 👍