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


##########
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:
+            # Return ISO string for dates outside JavaScript's safe range
+            return obj.isoformat()
+
         return datetime_to_epoch(obj)
 
     if isinstance(obj, date):
+        # Check if date is within JavaScript's safe date range

Review Comment:
   Here's what _le bot_ says:
   <img width="712" height="654" alt="image" 
src="https://github.com/user-attachments/assets/4c4d6c25-288a-412e-a958-dc16a15dfc9c";
 />
   



-- 
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]

Reply via email to