Skip to content

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
@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
gw0ods pushed a commit to Valandem/ValandemApp that referenced this pull request Dec 15, 2025
ralliee777 pushed a commit to ralliee777/full-stack-fastapi-template that referenced this pull request Dec 18, 2025
ralliee777 added a commit to ralliee777/full-stack-fastapi-template that referenced this pull request Dec 18, 2025
…y.py

This reverts the datetime.now(timezone.utc) change back to datetime.utcnow()
for E2E testing purposes.
ralliee777 added a commit to ralliee777/full-stack-fastapi-template that referenced this pull request Dec 18, 2025
This reverts the datetime.now(timezone.utc) change back to datetime.utcnow()
for E2E testing purposes.
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