Skip to content

Commit

Permalink
Fix for initialVisibleMonth in DayPickerRangeController react-dates#613
Browse files Browse the repository at this point in the history
  • Loading branch information
aleib authored and Maja Wichrowska committed Jul 7, 2017
1 parent a05a63f commit 6ba73f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/DayPickerRangeController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ export default class DayPickerRangeController extends React.Component {
onOutsideClick,
withPortal,
enableOutsideDays,
startDate,
initialVisibleMonth,
hideKeyboardShortcutsPanel,
daySize,
Expand All @@ -819,6 +820,8 @@ export default class DayPickerRangeController extends React.Component {
} = this.props;

const { phrases, visibleDays } = this.state;
const initialVisibleMonthThunk =
initialVisibleMonth || (startDate ? () => startDate : () => moment());

return (
<DayPicker
Expand All @@ -837,7 +840,7 @@ export default class DayPickerRangeController extends React.Component {
renderMonth={renderMonth}
withPortal={withPortal}
hidden={!focusedInput}
initialVisibleMonth={initialVisibleMonth}
initialVisibleMonth={initialVisibleMonthThunk}
daySize={daySize}
onOutsideClick={onOutsideClick}
navPrev={navPrev}
Expand Down

0 comments on commit 6ba73f5

Please sign in to comment.