kiorky / croniter

MIT License
403 stars 39 forks source link

datetime.utcnow and datetime.utcfromtimestamp are deprecated in Python 3.12 #49

Closed tirkarthi closed 1 year ago

tirkarthi commented 1 year ago

datetime.datetime’s utcnow() and utcfromtimestamp() are deprecated and will be removed in a future version. Instead, use timezone-aware objects to represent datetimes in UTC: respectively, call now() and fromtimestamp() with the tz parameter set to datetime.UTC. (Contributed by Paul Ganssle in python/cpython#103857.)

croniter/src/croniter/tests/test_croniter.py
960:            dt = datetime.utcfromtimestamp(c.get_next())
980:            dt = datetime.utcfromtimestamp(c.get_next())
1003:            dt = datetime.utcfromtimestamp(c.get_next())

croniter/src/croniter/croniter.py
230:        result = datetime.datetime.utcfromtimestamp(timestamp)
862:        start, stop = (datetime.datetime.utcfromtimestamp(t) for t in (start, stop))
kiorky commented 1 year ago

I do not see a fix for now, as i m not willing to drop support for python2...