From 9dd5aab6232eb1b0e66e68ede26058beb53b96cf Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Sun, 15 Jul 2018 06:23:55 +0200 Subject: [PATCH] [enh] makes date readable --- templates/index.html | 11 ++++++++--- templates/job.html | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/templates/index.html b/templates/index.html index f74614f..c44f78f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -27,9 +27,9 @@ {{job.state}} {{job.target_revision}} {{job.yunohost_version}} - {{job.created_time}} - {{job.started_time}} - {{job.end_time}} + {{timestampToDate(job.created_time)}} + {{timestampToDate(job.started_time)}} + {{timestampToDate(job.end_time)}} @@ -41,6 +41,11 @@ data: { jobs: [] }, + methods: { + timestampToDate: function (timestamp) { + return new Date(timestamp * 1000).toLocaleString() + } + } }) ws = new WebSocket('ws://' + document.domain + ':' + location.port + '/index-ws'); diff --git a/templates/job.html b/templates/job.html index d9324fc..42f087e 100644 --- a/templates/job.html +++ b/templates/job.html @@ -17,9 +17,9 @@ State{{job.state}} Target revision{{job.target_revision}} YunoHost version{{job.yunohost_version}} - Created time{{job.created_time}} - Started time{{job.started_time}} - End time{{job.end_time}} + Created time{{timestampToDate(job.created_time)}} + Started time{{timestampToDate(job.started_time)}} + End time{{timestampToDate(job.end_time)}}

Excution log:

@@ -32,6 +32,11 @@ data: { job: {} }, + methods: { + timestampToDate: function (timestamp) { + return new Date(timestamp * 1000).toLocaleString() + } + } }) ws = new WebSocket('ws://' + document.domain + ':' + location.port + '/job-%s-ws');