Skip to content

Timezone-aware datetime objects#752

Draft
tacerus wants to merge 1 commit into
openSUSE:openSUSE/release/3006.0from
tacerus:bp-datetime
Draft

Timezone-aware datetime objects#752
tacerus wants to merge 1 commit into
openSUSE:openSUSE/release/3006.0from
tacerus:bp-datetime

Conversation

@tacerus

@tacerus tacerus commented Mar 22, 2026

Copy link
Copy Markdown
Member

Cherry-pick upstream patch from saltstack/salt#66902 to solve some, if not all, of the 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). messages.

datetime.datetime.utcnow() is deprecated in Python 3.12, and it's
recommended to switch to timezone-aware objects, so do this. It also
simplifies local time handling, as .astimezone() method can be used
instead of calculating timezone_delta manually.

Part of #65604
@tacerus tacerus marked this pull request as draft March 22, 2026 13:16
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