You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bb...@apache.org on 2022/04/21 15:33:32 UTC
[airflow] branch main updated: Fix timezone display for logs on UI (#23075)
This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new e57c7aeda8 Fix timezone display for logs on UI (#23075)
e57c7aeda8 is described below
commit e57c7aeda8c5cd9d0f10e2ce46a155ea01181140
Author: Maksim <ma...@gmail.com>
AuthorDate: Thu Apr 21 17:33:19 2022 +0200
Fix timezone display for logs on UI (#23075)
---
airflow/www/static/js/datetime_utils.js | 2 +-
airflow/www/static/js/ti_log.js | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/airflow/www/static/js/datetime_utils.js b/airflow/www/static/js/datetime_utils.js
index 1cbd6fa2d9..0601971114 100644
--- a/airflow/www/static/js/datetime_utils.js
+++ b/airflow/www/static/js/datetime_utils.js
@@ -78,7 +78,7 @@ export function updateAllDateTimes() {
const dt = moment($el.attr('datetime'));
// eslint-disable-next-line no-underscore-dangle
if (dt._isValid) {
- $el.text(dt.format(defaultFormat));
+ $el.text(dt.format($el.data('with-tz') ? defaultFormatWithTZ : defaultFormat));
}
if ($el.attr('title') !== undefined) {
// If displayed date is not UTC, have the UTC date in a title attribute
diff --git a/airflow/www/static/js/ti_log.js b/airflow/www/static/js/ti_log.js
index 7253152384..7a3b9ae54c 100644
--- a/airflow/www/static/js/ti_log.js
+++ b/airflow/www/static/js/ti_log.js
@@ -17,7 +17,7 @@
* under the License.
*/
-/* global document, window, $, moment, Airflow */
+/* global document, window, $ */
import { escapeHtml } from './main';
import { getMetaValue } from './utils';
import { formatDateTime } from './datetime_utils';
@@ -118,10 +118,9 @@ function autoTailingLog(tryNumber, metadata = null, autoTailing = false) {
// The message may contain HTML, so either have to escape it or write it as text.
const escapedMessage = escapeHtml(item[1]);
- const tzOffset = moment().tz(Airflow.serverTimezone).format('Z');
const linkifiedMessage = escapedMessage
.replace(urlRegex, (url) => `<a href="${url}" target="_blank">${url}</a>`)
- .replaceAll(dateRegex, (date) => `<time datetime="${date}${tzOffset}">${formatDateTime(`${date}${tzOffset}`)}</time>`);
+ .replaceAll(dateRegex, (date) => `<time datetime="${date}+00:00" data-with-tz="true">${formatDateTime(`${date}+00:00`)}</time>`);
logBlock.innerHTML += `${linkifiedMessage}\n`;
});