From: gregor herrmann Date: Thu, 9 Aug 2018 13:53:42 +0000 (+0200) Subject: format datetime in tooltip headers X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/commitdiff_plain/a663c3923a9448fd25c92f6fdbe0e10bfa480418 format datetime in tooltip headers --- 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); } } },