pwdsudinym-ui commented on code in PR #55339:
URL: https://github.com/apache/airflow/pull/55339#discussion_r2365702395


##########
airflow-core/src/airflow/ui/src/components/DurationChart.tsx:
##########
@@ -114,6 +118,24 @@ export const DurationChart = ({
     value: (ctx: PartialEventContext) => average(ctx, 0),
   };
 
+  const getLabelFormat = (entries: Array<RunResponse>) => {
+    const timestamps = entries.map(entry => dayjs(entry.run_after));
+    const minTime = dayjs.min(timestamps);
+    const maxTime = dayjs.max(timestamps);
+    
+    // satisfy null typecheck for dayjs.min/max
+    if (minTime === null || maxTime === null) {
+      return "MM-DD";
+    }
+    const diffInDays = maxTime.diff(minTime, 'days');
+
+    if (diffInDays < 1) {
+      return "hh:mm:ss"
+    } else {
+      return "MM-DD"
+    }
+  };
+

Review Comment:
   Cool, moved this outside the component



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

Reply via email to