Skip to content

Commit 566dd9f

Browse files
committed
fix: issue2551278 - datetime.datetime.utcnow deprecation.
Original fix always failed the import and fell back to the exception case. This method should work and test both code paths in datetime_.py.
1 parent aa19d60 commit 566dd9f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

roundup/anypy/datetime_.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# https://issues.roundup-tracker.org/issue2551278
22
# datetime.utcnow deprecated
33
try:
4-
from datetime import now, UTC
4+
from datetime import datetime, UTC
55

66
def utcnow():
7-
return now(UTC)
7+
return datetime.now(UTC)
8+
89
except ImportError:
9-
import datetime
10+
from datetime import datetime
1011

1112
def utcnow():
12-
return datetime.datetime.utcnow()
13+
return datetime.utcnow()

0 commit comments

Comments
 (0)