Skip to content

Commit 333a79c

Browse files
committed
Better timezone offset
1 parent b94ad01 commit 333a79c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/modes/exportdata/ExportData.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
endDate = urlParams.has('end_day') ? new Date(urlParams.get('end_day')) : param.sparkLineTimeFrame.max;
5757
5858
// Also normalize the dates to the current timezone
59-
startDate = new Date(startDate.getTime() + Math.abs(startDate.getTimezoneOffset() * 60000));
60-
endDate = new Date(endDate.getTime() + Math.abs(endDate.getTimezoneOffset() * 60000));
59+
startDate = new Date(startDate.getTime() - startDate.getTimezoneOffset() * -60000);
60+
endDate = new Date(endDate.getTime() - endDate.getTimezoneOffset() * -60000);
6161
}
6262
$: initDate($currentDateObject);
6363
@@ -122,7 +122,7 @@
122122
asOfMode = 'single';
123123
asOfDate = new Date(urlParams.get('as_of'));
124124
// Also normalize the dates to the current timezone
125-
asOfDate = new Date(asOfDate.getTime() + Math.abs(asOfDate.getTimezoneOffset() * 60000));
125+
asOfDate = new Date(asOfDate.getTime() - asOfDate.getTimezoneOffset() * -60000);
126126
}
127127
128128
let form = null;

0 commit comments

Comments
 (0)