X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/blobdiff_plain/cdfe54ab072113e4078b85943536df721005c64b..32289b0c8cb2b0d0ae9436fdad60238ea68f87f5:/web/static/seepark_web.js?ds=sidebyside diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index a9d4756..4ee570f 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -13,9 +13,9 @@ function dayschart(element, title, days, xtickformat) { '0416a1bab9ff': '0416a1bab9ff_x' }, names: { - '0416a1ac66ff': 'Wassertemperatur in 30 cm Tiefe', - '0516a207a4ff': 'Wassertemperatur in 50 cm Tiefe', - '0416a1bab9ff': 'Wassertemperatur in 1 m Tiefe' + '0416a1ac66ff': 'Wassertemperatur 30cm Tiefe', + '0516a207a4ff': 'Wassertemperatur 50cm Tiefe', + '0416a1bab9ff': 'Wassertemperatur 1m Tiefe' }, xFormat: '%Y-%m-%d %H:%M:%S', colors: { @@ -109,7 +109,7 @@ function dayschart(element, title, days, xtickformat) { name: function (name, ratio, id, index) { var prefix = ''; if (element.substr(0, 7) == 'chart_w') { - var re = /\d+ c?m/; + var re = /\d+ ?c?m/; prefix = 'Wasser '; } else { var re = /Luft/; @@ -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); } } },