(obj: Any, json_options: JSONOptions)
| 832 | |
| 833 | |
| 834 | def _encode_datetimems(obj: Any, json_options: JSONOptions) -> dict: # type: ignore[type-arg] |
| 835 | if ( |
| 836 | json_options.datetime_representation == DatetimeRepresentation.ISO8601 |
| 837 | and 0 <= int(obj) <= _MAX_UTC_MS |
| 838 | ): |
| 839 | return _encode_datetime(obj.as_datetime(), json_options) |
| 840 | elif json_options.datetime_representation == DatetimeRepresentation.LEGACY: |
| 841 | return {"$date": int(obj)} |
| 842 | return {"$date": {"$numberLong": str(int(obj))}} |
| 843 | |
| 844 | |
| 845 | def _encode_code(obj: Code, json_options: JSONOptions) -> dict: # type: ignore[type-arg] |
nothing calls this directly
no test coverage detected