Skip to content

Commit

Permalink
Update date range handling in controls reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
Latta committed Nov 7, 2024
1 parent e8337a8 commit e6d7ab0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/actions/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ export const changeDateFilter = ({newMin = false, newMax = false, quickdraw = fa
const { tree, treeToo, controls, frequencies } = getState();
if (!tree.nodes) {return;}
const dates = {
dateMinNumeric: newMin ? calendarToNumeric(newMin) : controls.dateMinNumeric,
dateMaxNumeric: newMax ? calendarToNumeric(newMax) : controls.dateMaxNumeric
dateMinNumeric: newMin ? calendarToNumeric(newMin) : Math.min(controls.dateMinNumeric, tree.nodesByNumDate[0][0]),
dateMaxNumeric: newMax ? calendarToNumeric(newMax) : Math.max(controls.dateMaxNumeric, tree.nodesByNumDate[tree.nodesByNumDate.length-1][0])
};
const data = calculateVisiblityAndBranchThickness(tree, controls, dates);
const dispatchObj = {
Expand Down
4 changes: 2 additions & 2 deletions src/reducers/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export const getDefaultControlsState = () => {
defaults.sidebarOpen = initialSidebarState.sidebarOpen;
}

const dateMin = numericToCalendar(currentNumDate() - defaultDateRange);
const dateMax = currentCalDate();
const dateMin = numericToCalendar(1900);
const dateMax = numericToCalendar(currentNumDate() + 100); // 100 years into the future
const dateMinNumeric = calendarToNumeric(dateMin);
const dateMaxNumeric = calendarToNumeric(dateMax);
return {
Expand Down

0 comments on commit e6d7ab0

Please sign in to comment.