Mercurial > p > roundup > code
view roundup/anypy/datetime_.py @ 7590:5fbd3af526bd
fix: issue2551278 - datetime.datetime.utcnow deprecation.
We now use the timezone aware utc dates for python 3.11+.
But we have to make all the rest of the dates (datetime.min, unix
epoch date) timezon aware so we can subtract them. Also need to
marshall/unmarshall timezone aware iso formatted date strings.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 27 Jul 2023 00:53:36 -0400 |
| parents | 6894f152d49a |
| children | d5d7ecd31864 |
line wrap: on
line source
# https://issues.roundup-tracker.org/issue2551278 # datetime.utcnow deprecated try: from datetime import datetime, UTC def utcnow(): return datetime.now(UTC) except ImportError: from datetime import datetime def utcnow(): return datetime.utcnow()
