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

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

Merged
merged 1 commit into from
Apr 30, 2024
Merged

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

merged 1 commit into from
Apr 30, 2024

Conversation

joshdavham
Copy link
Member

@joshdavham joshdavham commented Apr 29, 2024

PR to address issue #28

  • New card objects when created are now timezone-aware in addition to being UTC
  • When cards are repeated, the time value they receive must be timezone-aware and UTC
  • Updated the README with new example
  • Added new tests and modified the old one
  • Bumped major version from 1.2.0 -> 2.0.0 since these are breaking changes

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 👍

Copy link
Member

@L-M-Sherlock L-M-Sherlock left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for your great contribution!

@L-M-Sherlock L-M-Sherlock added this pull request to the merge queue Apr 30, 2024
Merged via the queue into open-spaced-repetition:main with commit a065ab6 Apr 30, 2024
2 checks passed
@joshdavham joshdavham deleted the update-datetime branch April 30, 2024 02:50
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