@@ -129,7 +129,7 @@ def _datetime_to_millis(dtm: datetime.datetime) -> int:
129
129
# Inclusive and exclusive min and max for timezones.
130
130
# Timezones are hashed by their offset, which is a timedelta
131
131
# and therefore there are more than 24 possible timezones.
132
- def _min_datetime_ms (tz : datetime .timezone = datetime . timezone . utc ) -> int :
132
+ def _min_datetime_ms (tz : datetime .tzinfo = utc ) -> int :
133
133
delta = tz .utcoffset (_MIN_UTC )
134
134
if delta is not None :
135
135
offset_millis = (delta .days * 86400 + delta .seconds ) * 1000 + delta .microseconds // 1000
@@ -138,7 +138,7 @@ def _min_datetime_ms(tz: datetime.timezone = datetime.timezone.utc) -> int:
138
138
return max (_MIN_UTC_MS , _MIN_UTC_MS - offset_millis )
139
139
140
140
141
- def _max_datetime_ms (tz : datetime .timezone = datetime . timezone . utc ) -> int :
141
+ def _max_datetime_ms (tz : datetime .tzinfo = utc ) -> int :
142
142
delta = tz .utcoffset (_MAX_UTC )
143
143
if delta is not None :
144
144
offset_millis = (delta .days * 86400 + delta .seconds ) * 1000 + delta .microseconds // 1000
@@ -156,7 +156,7 @@ def _millis_to_datetime(
156
156
or opts .datetime_conversion == DatetimeConversion .DATETIME_CLAMP
157
157
or opts .datetime_conversion == DatetimeConversion .DATETIME_AUTO
158
158
):
159
- tz = opts .tzinfo or datetime . timezone . utc
159
+ tz = opts .tzinfo or utc
160
160
if opts .datetime_conversion == DatetimeConversion .DATETIME_CLAMP :
161
161
millis = max (_min_datetime_ms (tz ), min (millis , _max_datetime_ms (tz )))
162
162
elif opts .datetime_conversion == DatetimeConversion .DATETIME_AUTO :
0 commit comments