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 c96789b  Fix log timezone in task log view (#19342) (#19401)
c96789b is described below

commit c96789b85cf59ece65f055e158f9559bb1d18faa
Author: calfzhou <[email protected]>
AuthorDate: Sat Nov 6 00:04:58 2021 +0800

    Fix log timezone in task log view (#19342) (#19401)
---
 airflow/www/static/js/ti_log.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/airflow/www/static/js/ti_log.js b/airflow/www/static/js/ti_log.js
index 8c11b75..08e5ed2 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, $, */
+/* global document, window, $, moment, Airflow */
 import { escapeHtml } from './main';
 import getMetaValue from './meta_value';
 import { formatDateTime } from './datetime_utils';
@@ -115,9 +115,10 @@ 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}+00:00">${formatDateTime(`${date}+00:00`)}</time>`);
+          .replaceAll(dateRegex, (date) => `<time 
datetime="${date}${tzOffset}">${formatDateTime(`${date}${tzOffset}`)}</time>`);
         logBlock.innerHTML += `${linkifiedMessage}\n`;
       });
 

Reply via email to