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

♻️ Replace deprecated utcnow() with now(timezone.utc) in utils module #1247

Merged
merged 2 commits into from
Jul 22, 2024
Merged

♻️ Replace deprecated utcnow() with now(timezone.utc) in utils module #1247

merged 2 commits into from
Jul 22, 2024

Conversation

jalvarezz13
Copy link
Contributor

This pull request addresses the deprecation of the datetime.utcnow() function by replacing it with datetime.now(timezone.utc) in the utils module.

Before

from datetime import datetime
datetime.utcnow()

After

from datetime import datetime, timezone
datetime.now(timezone.utc)

Source: https://docs-python-org.translate.goog/3/library/datetime.html?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=es&_x_tr_pto=sc#datetime.datetime.utcnow

@alejsdev alejsdev changed the title Replace deprecated utcnow() with now(timezone.utc) in utils module ♻️ Replace deprecated utcnow() with now(timezone.utc) in utils module Jul 2, 2024
@PierrickLP
Copy link

You could change it in backend/app/core/security.py too.

@jalvarezz13
Copy link
Contributor Author

Thanks for the heads up @PierrickLP
I just committed the change

@jalvarezz13
Copy link
Contributor Author

@alejsdev will we merge this?

Copy link

@GDemay GDemay left a comment

Choose a reason for hiding this comment

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

From my search, there is no more utcnow() after your change. Sounds good!
Nice job ;)

Copy link
Member

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

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

Nice! 🚀

@alejsdev alejsdev merged commit 6e1c888 into fastapi:master Jul 22, 2024
3 checks passed
@alejsdev
Copy link
Member

Hi @jalvarezz13, thanks for your contribution! and thanks to everyone for the help 🤓

gusevyaroslove pushed a commit to gusevyaroslove/fastapi-template that referenced this pull request Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants