Skip to content

Commit b94ad01

Browse files
committed
Date off-by-one error fix
1 parent f978fa7 commit b94ad01

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/modes/exportdata/ExportData.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
// Populate date based on URL params or, if absent, the current date
5555
startDate = urlParams.has('start_day') ? new Date(urlParams.get('start_day')) : param.sparkLineTimeFrame.min;
5656
endDate = urlParams.has('end_day') ? new Date(urlParams.get('end_day')) : param.sparkLineTimeFrame.max;
57+
58+
// 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));
5761
}
5862
$: initDate($currentDateObject);
5963
@@ -117,6 +121,8 @@
117121
if (urlParams.has('as_of') && !isNaN(new Date(urlParams.get('as_of')))) {
118122
asOfMode = 'single';
119123
asOfDate = new Date(urlParams.get('as_of'));
124+
// Also normalize the dates to the current timezone
125+
asOfDate = new Date(asOfDate.getTime() + Math.abs(asOfDate.getTimezoneOffset() * 60000));
120126
}
121127
122128
let form = null;

0 commit comments

Comments
 (0)