Skip to content

Commit d0367ff

Browse files
committed
PYTHON-4691 Simplify
1 parent 9a0d113 commit d0367ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bson/datetime_ms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def _min_datetime_ms(tz: datetime.timezone = datetime.timezone.utc) -> int:
126126
try:
127127
dtm = _MIN_UTC.astimezone(tz)
128128
except OverflowError:
129-
dtm = (_MIN_UTC - tz.utcoffset(_MIN_UTC)).astimezone(tz)
129+
dtm = _MIN_UTC.replace(tzinfo=tz)
130130
return _datetime_to_millis(dtm)
131131

132132

@@ -135,7 +135,7 @@ def _max_datetime_ms(tz: datetime.timezone = datetime.timezone.utc) -> int:
135135
try:
136136
dtm = _MAX_UTC.astimezone(tz)
137137
except OverflowError:
138-
dtm = (_MAX_UTC - tz.utcoffset(_MAX_UTC)).astimezone(tz)
138+
dtm = _MAX_UTC.replace(tzinfo=tz)
139139
return _datetime_to_millis(dtm)
140140

141141

0 commit comments

Comments
 (0)