renzepost commented on code in PR #32465:
URL: https://github.com/apache/airflow/pull/32465#discussion_r1258868475


##########
airflow/www/static/js/task.js:
##########
@@ -25,12 +25,17 @@ import validator from "validator";
 document.addEventListener("DOMContentLoaded", () => {
   document.querySelectorAll(".js-ti-attr").forEach((attr) => {
     const value = attr.innerHTML;
+    const attrName = attr.previousElementSibling.textContent.trim();
     if (value.length === 32 && moment(value, "YYYY-MM-DD").isValid()) {
       // 32 is the length of our timestamps
       // eslint-disable-next-line no-param-reassign
       attr.innerHTML = "";
       const timeElement = document.createElement("time");
       timeElement.setAttribute("datetime", value);
+      timeElement.setAttribute(
+        "data-datetime-convert",
+        attrName === "execution_date" ? "false" : "true"
+      );

Review Comment:
   Yes, good idea. I need to rework this a little too. With this solution, the 
execution date won't be updated when the user changes the display timezone. 
However, JS date types don't have microsecond precision. So currently the best 
that can be done is millisecond precision for execution date when displayed in 
the UI, while at the same time being able to switch display timezone. It won't 
satisfy the bug report completely though.
   Another thing I overlooked is that if `data-datetime-convert` is `true` (or 
unset), the `title` attribute of the time element will be filled with the 
datetime in UTC, if the display timezone is set to non-UTC. This solution would 
break that behavior for execution date too.
   Let me know your thoughts.



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