codeant-ai-for-open-source[bot] commented on code in PR #44701:
URL: https://github.com/apache/superset/pull/44701#discussion_r4183055066


##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts:
##########
@@ -41,9 +41,21 @@ export const getSmartDateDetailedFormatter = () =>
 export const getSmartDateFormatter = (timeGrain?: string) => {
   const baseFormatter = getTimeFormatter(SMART_DATE_ID);
 
-  // If no time grain provided, use the standard smart date formatter
+  // Without a time grain there is no bucket to normalize to, but the raw
+  // smart formatter's finest tier is '.%Lms' — any tick carrying sub-second
+  // noise (e.g. the axis-extent boundary label ECharts pads beyond the data)
+  // would render as '.943ms'. Floor to the second so the adaptive tiers pick
+  // a real unit instead (#44698).
   if (!timeGrain) {
-    return baseFormatter;
+    return new TimeFormatter({
+      id: SMART_DATE_ID,
+      label: baseFormatter.label,
+      formatFunc: (date: Date) => {
+        const floored = new Date(date);
+        floored.setMilliseconds(0);
+        return baseFormatter(floored);
+      },
+    });

Review Comment:
   ✅ **CodeAnt verified this suggestion was addressed in subsequent commits and 
marked this thread resolved** as of `784b0fb`.
   
   When no time grain is provided, the function returns the base formatter 
before creating or normalizing a date, preserving sub-second timestamps.
   
   <sub>If that's not right, unresolve this thread and CodeAnt will leave it 
open.</sub>
   
   <!-- codeant-auto-resolve-reply -->



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