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

Updated releaseWizard.py to use timezone-aware objects to represent datetimes in UTC #14102

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

shubhamsrkdev
Copy link
Contributor

@shubhamsrkdev shubhamsrkdev commented Jan 4, 2025

Quoting from python release doc :

datetime: datetime.datetime’s utcnow() and utcfromtimestamp() are deprecated and will be removed in a future version. Instead, use timezone-aware objects to represent datetimes in UTC: respectively, call now() and fromtimestamp() with the tz parameter set to datetime.UTC.

Owing to this made two types of changes:

  1. Replaced datetime.utcnow() with datetime.now(tz=timezone.utc)
  2. Replaced datetime.utcfromtimestamp(timestamp1) with datetime.fromtimestamp(timestamp=timestamp1, tz=timezone.utc)

Fixes #14063

@shubhamsrkdev
Copy link
Contributor Author

@ChrisHegarty / @rmuir fyi please check this whenever convenient. TIA!

Copy link
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

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

LGTM

@ChrisHegarty ChrisHegarty merged commit 3fad719 into apache:main Jan 9, 2025
5 checks passed
ChrisHegarty pushed a commit that referenced this pull request Jan 9, 2025
@shubhamsrkdev shubhamsrkdev deleted the replacedwithtzaware branch January 9, 2025 13:10
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.

releaseWizard.py DeprecationWarning: datetime.datetime.utcnow() is deprecated
2 participants