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

Remove usages of deprecated datetime.utcnow() and datetime.utcfromtimestamp() #765

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

kozlek
Copy link
Contributor

@kozlek kozlek commented Nov 19, 2023

Changes:

  • removed usages of datetime.utcnow() and datetime.utcfromtimestamp()
  • added freezegun as test dependency to handle properly time patching during tests

Notes:

  • the chosen approach in this PR uses aware datetimes by default and downgrade to naive datetime if needed. Before it was the contrary.
  • aware_utcnow and datetime_from_epoch can still return naive datetime if settings.USE_TZ is False (original behaviour) -> we might want to force aware datetime in a future release
  • make_utc function has been kept but it is only used by our tests, not library code

Copy link
Member

@Andrew-Chen-Wang Andrew-Chen-Wang left a comment

Choose a reason for hiding this comment

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

Thanks for this!

Copy link
Member

@50-Course 50-Course left a comment

Choose a reason for hiding this comment

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

...aware_utcnow and datetime_from_epoch can still return naive datetime if settings.USE_TZ is False (original behaviour) -> we might want to force aware datetime in a future release

Thank you for this PR! Would be approving changes since, there is no breakage in library code.

@Andrew-Chen-Wang Andrew-Chen-Wang merged commit 8ae34dd into jazzband:master Dec 4, 2023
2 of 3 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.

3 participants