initialVisibleMonth doesn't work if we specify `focusedInput: START_DATE` in the initial state
See original GitHub issuereact-dates@21.1.0
constructor(props) {
super(props);
this.state = {
focusedInput: START_DATE,
periodSelectionType: "day",
};
}
<DayPickerRangeController
onDatesChange={({ startDate, endDate }) =>
this.props.onDatesChange(moment(startDate), moment(endDate).endOf('day'))}
onFocusChange={(focusedInput) => this.onFocusChange(focusedInput)}
focusedInput={this.state.focusedInput}
initialVisibleMonth={() => moment().add(10, 'months') }
/>
It works if we specify focusedInput: "startDate"
See the codesandbox
Windows 10 Chrome 76.0.3809.132
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
initialVisibleMonth doesn't work if we specify `focusedInput ...
react-dates@21.1.0 constructor(props) { super(props); this.state = { focusedInput: START_DATE, periodSelectionType: "day", }; } this.props.
Read more >airbnb/react-dates DayPickerRangeController set visible ...
I found workaround solution. Unmounting component and then render with new initialMonth import { useState } from "react"; import moment from ...
Read more >Storybook - GitHub Pages
Note that the focusedInput prop may be null, but if this is the case, dates are not selectable. As a result, in the...
Read more >React-dates - Airbnb Engineering & Data Science
Dates: Moment objects representing the currently selected start and end dates. To indicate that a date has not yet been selected, these are...
Read more >react-dates - Best of JS
The user will only be able to select a date if focusedInput is provided. Here is the minimum REQUIRED setup you need to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Worth noting that #53 exposed these in
react-dates/constants
:import { START_DATE } from 'react-dates/constants';
Yep! Let’s only export the ones that have use cases; we can export more later.