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 datetime.utcnow() with timezone-aware alternative #996

Open
jay-tau opened this issue Feb 24, 2025 · 0 comments
Open

Comments

@jay-tau
Copy link

jay-tau commented Feb 24, 2025

The current implementation in /lib/security/howdy/compare.py uses the deprecated datetime.datetime.utcnow() method, which triggers the following deprecation warning:

/lib/security/howdy/compare.py:57: 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).
  "Date: " + datetime.datetime.utcnow().strftime("%Y/%m/%d %H:%M:%S UTC"),

This method is scheduled for removal in a future Python version. We need to update our code to use the recommended timezone-aware alternative.

Benefits

  • Eliminates the deprecation warning
  • Ensures compatibility with future Python versions
  • Uses the recommended timezone-aware approach for handling UTC datetimes

Additional notes

  • This change may require updating the minimum Python version requirement for the project
  • We should consider scanning the codebase for other instances of datetime.utcnow() and update them as well.

I've searched for similar issues already, and my issue has not been reported yet.

Linux distribution (if applicable): EndeavourOS

Howdy version (sudo howdy version): Howdy 2.6.1

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

No branches or pull requests

1 participant