From a663c3923a9448fd25c92f6fdbe0e10bfa480418 Mon Sep 17 00:00:00 2001 From: gregor herrmann Date: Thu, 9 Aug 2018 15:53:42 +0200 Subject: [PATCH] format datetime in tooltip headers --- web/static/seepark_web.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index 2944e90..4ee570f 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -120,9 +120,15 @@ function dayschart(element, title, days, xtickformat) { value: function (value, ratio, id, index) { return value.toFixed(2) + '°'; }, - title: function (x) { - // TODO: format datetime into something readable - return x; + title: function (datetime) { + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString + options = { + weekday: 'short', + year: 'numeric', month: 'numeric', day: 'numeric', + hour: 'numeric', minute: 'numeric', second: 'numeric', + timeZone: 'Europe/Vienna', timeZoneName: 'short' + }; + return datetime.toLocaleString('de-AT', options); } } }, -- 2.47.3