diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2011-12-07 23:27:27 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2011-12-07 23:27:27 +0100 |
commit | 2c9b6c09c99eba4939ea1617036ba5bae6889b2a (patch) | |
tree | 4e3b7f3a03ad285eb5cd48259510d55fc1cf0198 /ebus/webapp/static/src/ebus.js | |
parent | 0645c27fbd1082fe70e08a049e2cbb0200fd3cb6 (diff) | |
download | ebus-alt-2c9b6c09c99eba4939ea1617036ba5bae6889b2a.tar.gz ebus-alt-2c9b6c09c99eba4939ea1617036ba5bae6889b2a.zip |
fix timezone handling
Diffstat (limited to 'ebus/webapp/static/src/ebus.js')
-rw-r--r-- | ebus/webapp/static/src/ebus.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ebus/webapp/static/src/ebus.js b/ebus/webapp/static/src/ebus.js index ba14f51..46a9ed8 100644 --- a/ebus/webapp/static/src/ebus.js +++ b/ebus/webapp/static/src/ebus.js @@ -66,10 +66,15 @@ $(document).ready(function(){ unplotSensorDetail(sensorname); unplotSensorOverview(sensorname); }; + var tzFix = function(d) { + return d - new Date().getTimezoneOffset() * 60 * 1000; + } + var plotSensorDetail = function(sensorConfig) { $.getJSON("sensor/"+escape(sensorConfig.sensorname)+"/"+from+"/"+to, function(response) { if (response['data']) { + response.data = response.data.map(function(d) { return [ tzFix(d[0]), d[1] ]; }); datasetDetail.push({'data':response['data'], 'label':sensorConfig.sensorname, 'color':sensorConfig.color}); @@ -94,6 +99,7 @@ $(document).ready(function(){ $.getJSON("sensor_cached/"+escape(sensorConfig.sensorname)+"/"+fromOverview, //+"/"+to, function(response) { if (response['data']) { + response.data = response.data.map(function(d) { return [ tzFix(d[0]), d[1] ]; }); datasetOverview.push({'data':response['data'], 'label':sensorConfig.sensorname, 'color':sensorConfig.color}); |