Skip to content

Commit 928aade

Browse files
committed
Considering TimezoneOffset
+ client side calculation of the timezone offset
1 parent 183647e commit 928aade

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

sensorplot_webinterface.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ function createGraphModule(title, unit, slag, interval, good, bad, min, max, cli
383383
\n\
384384
const csvLink = document.createElement('a');\n\
385385
csvLink.addEventListener('click', () => {\n\
386-
window.open('./csv/' + slag + '?timestamp=' + parseInt(Date.now() / 1000), '_blank');\n\
386+
window.open('./csv/' + slag + '?timestamp=' + parseInt((Date.now() / 1000) - (new Date().getTimezoneOffset() * 60)), '_blank');\n\
387387
});\n\
388388
csvLink.textContent = 'download csv';\n\
389389
graphModule.appendChild(csvLink);\n\
@@ -1018,6 +1018,11 @@ void SensorPlot_WebInterface::responseCSV(int index, int timestamp) {
10181018
String response;
10191019
response = "";
10201020

1021+
// If the UTF-16 Unicode byte order mark (BOM, U+FEFF) character is at the start of a UTF-8 file, the first three bytes will be 0xEF, 0xBB, 0xBF.
1022+
// 0xEF | B11101111 | ï
1023+
// 0xBB | B10111011 | »
1024+
// 0xBF | B10111111 | ¿
1025+
10211026
response += (this->plotter_p[index]->title + " (" + this->plotter_p[index]->unit + ")\n");
10221027
response += "Time;Value\n";
10231028
for(int i = 0; i < *(this->plotter_p[index]->valuesCount); i++) {

webInterface/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function createGraphModule(title, unit, slag, interval, good, bad, min, max, cli
185185

186186
const csvLink = document.createElement('a');
187187
csvLink.addEventListener('click', () => {
188-
window.open('./csv/' + slag + '?timestamp=' + parseInt(Date.now() / 1000), '_blank');
188+
window.open('./csv/' + slag + '?timestamp=' + parseInt((Date.now() / 1000) - (new Date().getTimezoneOffset() * 60)), '_blank');
189189
});
190190
csvLink.textContent = 'download csv';
191191
graphModule.appendChild(csvLink);

0 commit comments

Comments
 (0)