companion icon indicating copy to clipboard operation
companion copied to clipboard

The utcnow() method will be deprecated soon. Replaced it with recommened method.

Open asifrahaman13 opened this issue 9 months ago • 2 comments

Hey I noticed that at some places the utcnow() method has been use.

Since the function will be deprecated soon I have replaced this with the recommended one.

from datetime import datetime, UTC
print(datetime.now(UTC))

asifrahaman13 avatar May 13 '24 05:05 asifrahaman13

Hey @asifrahaman13! Thanks for the PR 🙂 there are a few details but at high level, the old syntax gets deprecated in Python 3.12. Datetime being part of the standard library, it follows python version, and currently the lib supports Python from 3.9 on. As you can see, mypy indicates that UTC cannot be imported from datetime in python 3.9 😅

So either:

  • there is another way to do this that is valid for 3.9 and 3.12
  • or we'll have to find another way

Btw, it seems you have run the formater / linter, have you installed precommit hooks? 🙂

Cheers

frgfm avatar May 13 '24 06:05 frgfm

Hey @frgfm

Thanks for the clarification. Sorry I guess I did not configured it correctly. Will do it soon!

asifrahaman13 avatar May 19 '24 05:05 asifrahaman13