ashb commented on a change in pull request #7693: [AIRFLOW-7046] 
Locale-formatted datetimes (UI only)
URL: https://github.com/apache/airflow/pull/7693#discussion_r391756465
 
 

 ##########
 File path: airflow/www/utils.py
 ##########
 @@ -282,7 +289,18 @@ def dt(attr):
         f = f.isoformat() if f else ''
         if timezone.utcnow().isoformat()[:4] == f[:4]:
             f = f[5:]
-        return Markup("<nobr>{}</nobr>").format(f)
+        return Markup('<time datetime="{}">{}</time>').format(f, f)
+    return dt
+
+
+def localized_f(attr_name):
+    def dt(attr):
+        f = attr.get(attr_name)
+        if f is None:
+            return Markup('<time datetime="{}">{}</time>').format(f, f)
+        else:
+            f = f.strftime(date_format)
+            return Markup('<time datetime="{}">{}</time>').format(f, f)
 
 Review comment:
   I would have though that we'd want the datetime attribute to always be in 
ISO8601, and convert just on client side.
   
   The main reason is that server locales are quite likely to be either C, or 
`en_US.UTF-8` (as this is the default for many cloud images, on EC2/GCE etc.).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to