Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
Fix time zone issues when tidying USAFacts county data
Browse files Browse the repository at this point in the history
  • Loading branch information
bertday committed Apr 24, 2020
1 parent 463afee commit f595fde
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/DataPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const mapStateToProps = (state) => {
// get county name
countyName = selectedCountyAttrs.name;
// date hardcoded for now until we add slider
const recentSnapshot = selectedCountySnapshots['2020-04-22T07:00:00.000Z'];
const recentSnapshot = selectedCountySnapshots['2020-04-22T00:00:00.000Z'];
totalDeaths = recentSnapshot.deaths;
totalCases = recentSnapshot.cases;
}
Expand Down
2 changes: 2 additions & 0 deletions src/datasets/datasetsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export function tidyUsafactsCounties(counties = [], countType) {
// cache a map of dates => iso dates
const snapshotDatesIso = snapshotDates.reduce((acc, snapshotDate) => {
const snapshotDateObj = new Date(Date.parse(snapshotDate));
// clear out time zone
snapshotDateObj.setUTCHours(0, 0, 0, 0);
const snapshotDateIso = snapshotDateObj.toISOString();
acc[snapshotDate] = snapshotDateIso;

Expand Down

0 comments on commit f595fde

Please sign in to comment.