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_r391752808
##########
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)
Review comment:
This would yield `<time datetime="None">None</time>` which would break
moment.js wouldn't it?. I guess we probably want
```suggestion
return None
```
or `return ''`?
----------------------------------------------------------------
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