Mercurial > p > roundup > code
comparison roundup/anypy/datetime_.py @ 7587:8f29e4ea05ce
fix: issue2551278 - datetime.datetime.utcnow deprecation.
Replace calls with equivalent that produces timezone aware dates
rather than naive dates.
Also some flake8 fixes for test/rest_common.py.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 25 Jul 2023 16:30:10 -0400 |
| parents | |
| children | 6894f152d49a |
comparison
equal
deleted
inserted
replaced
| 7586:859c57bc8d91 | 7587:8f29e4ea05ce |
|---|---|
| 1 # https://issues.roundup-tracker.org/issue2551278 | |
| 2 # datetime.utcnow deprecated | |
| 3 try: | |
| 4 from datetime import now, UTC | |
| 5 | |
| 6 def utcnow(): | |
| 7 return now(UTC) | |
| 8 except ImportError: | |
| 9 import datetime | |
| 10 | |
| 11 def utcnow(): | |
| 12 return datetime.datetime.utcnow() |
