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

fix: utcnow() warning with python 3.12 #373

Closed
wants to merge 1 commit into from

Conversation

Andarius
Copy link

@Andarius Andarius commented Feb 7, 2024

Fix warning for python 3.12 on utcnow()

Goal

Remove the following deprecation warning:

DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC)

Design

Since datetule.UTC does not exists in previous versions,

Changeset

Replaced utcnow() with dt.datetime.now(timezone.utc).replace(tzinfo=None)

Testing

Fix warning for python 3.12 on utcnow()
@Andarius Andarius marked this pull request as draft February 7, 2024 11:36
@Andarius Andarius closed this Feb 7, 2024
@Andarius Andarius deleted the fix/utcnow-py312 branch February 7, 2024 11:48
@fabiob
Copy link

fabiob commented May 5, 2024

Why was this closed? Can I help somehow?

@thimi0412
Copy link

I have the same problem.

@mclack
Copy link

mclack commented Nov 25, 2024

Hi all,

We have opened our own PR to replace utcnow calls: #394

While I don't have a clear ETA on when this will be released, we will make sure to put this through our full review process when priorities allow. Please feel free to keep an eye on the linked PR for updates.

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.

4 participants