mistercrunch commented on code in PR #34514:
URL: https://github.com/apache/superset/pull/34514#discussion_r2249434760


##########
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:
   So this means our JSON serializer tries to convert to epoch, and will return 
mixed types for dates (string or int depending on whether it fits in an int?) 
Wondering if it's handled properly in the frontend...



-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to