Skip to content

Commit 5a52cc3

Browse files
committed
PYTHON-4663 Fix json_util datetimems check
1 parent 68b4c19 commit 5a52cc3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bson/json_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
from bson.code import Code
126126
from bson.codec_options import CodecOptions, DatetimeConversion
127127
from bson.datetime_ms import (
128-
_MIN_UTC_MS,
128+
_MAX_UTC_MS,
129129
EPOCH_AWARE,
130130
DatetimeMS,
131131
_datetime_to_millis,
@@ -844,7 +844,7 @@ def _encode_binary(data: bytes, subtype: int, json_options: JSONOptions) -> Any:
844844
def _encode_datetimems(obj: Any, json_options: JSONOptions) -> dict:
845845
if (
846846
json_options.datetime_representation == DatetimeRepresentation.ISO8601
847-
and 0 <= int(obj) <= _MIN_UTC_MS
847+
and 0 <= int(obj) <= _MAX_UTC_MS
848848
):
849849
return _encode_datetime(obj.as_datetime(), json_options)
850850
elif json_options.datetime_representation == DatetimeRepresentation.LEGACY:

0 commit comments

Comments
 (0)