mistercrunch commented on code in PR #34514:
URL: https://github.com/apache/superset/pull/34514#discussion_r2249434864
##########
superset/utils/json.py:
##########
@@ -155,9 +160,27 @@ def json_int_dttm_ser(obj: Any) -> Any:
"""
if isinstance(obj, (datetime, pd.Timestamp)):
+ # Check if datetime is within JavaScript's safe date range
+ # If not, return ISO string instead of epoch milliseconds
+ if isinstance(obj, pd.Timestamp):
+ dttm = obj.to_pydatetime()
+ else:
+ dttm = obj
+
+ # Remove timezone info for comparison
+ dttm_no_tz = dttm.replace(tzinfo=None) if dttm.tzinfo else dttm
+
+ if dttm_no_tz < JS_DATE_RANGE_MIN or dttm_no_tz > JS_DATE_RANGE_MAX:
Review Comment:
Anyhow we're mostly good until 2286 :/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]