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

datetime.utcnow is deprecated #1178

Closed
guruofgentoo opened this issue Jul 1, 2024 · 1 comment · Fixed by #1182
Closed

datetime.utcnow is deprecated #1178

guruofgentoo opened this issue Jul 1, 2024 · 1 comment · Fixed by #1182

Comments

@guruofgentoo
Copy link

Python 3.12 deprecates the use of datetime.datetime.utcnow, suggesting instead to use datetime.datetime.now(datetime.UTC).

Example from the humanize method:

  File "/root/project/my_project/libs/utils.py", line 54, in arrow_humanize
    return time.humanize()
           ^^^^^^^^^^^^^^^
  File "/root/project/.tox/py312/lib/python3.12/site-packages/arrow/arrow.py", line 1150, in humanize
    utc = dt_datetime.utcnow().replace(tzinfo=dateutil_tz.tzutc())
          ^^^^^^^^^^^^^^^^^^^^
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).
@csessh
Copy link
Contributor

csessh commented Aug 3, 2024

Mind if I took this on? Seems like a fairly straightforward task to get started?

jadchaar added a commit that referenced this issue Aug 24, 2024
Co-authored-by: Jad Chaar <jadchaar@users.noreply.github.com>
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 a pull request may close this issue.

2 participants