Skip to content

Commit

Permalink
Date off-by-one error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rzats committed Mar 27, 2024
1 parent f978fa7 commit b94ad01
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modes/exportdata/ExportData.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
// Populate date based on URL params or, if absent, the current date
startDate = urlParams.has('start_day') ? new Date(urlParams.get('start_day')) : param.sparkLineTimeFrame.min;
endDate = urlParams.has('end_day') ? new Date(urlParams.get('end_day')) : param.sparkLineTimeFrame.max;
// Also normalize the dates to the current timezone
startDate = new Date(startDate.getTime() + Math.abs(startDate.getTimezoneOffset() * 60000));
endDate = new Date(endDate.getTime() + Math.abs(endDate.getTimezoneOffset() * 60000));
}
$: initDate($currentDateObject);
Expand Down Expand Up @@ -117,6 +121,8 @@
if (urlParams.has('as_of') && !isNaN(new Date(urlParams.get('as_of')))) {
asOfMode = 'single';
asOfDate = new Date(urlParams.get('as_of'));
// Also normalize the dates to the current timezone
asOfDate = new Date(asOfDate.getTime() + Math.abs(asOfDate.getTimezoneOffset() * 60000));
}
let form = null;
Expand Down

0 comments on commit b94ad01

Please sign in to comment.