Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

is initialVisibleMonth now required for DayPickerRangeController? #613

Closed
terebentina opened this issue Jul 3, 2017 · 4 comments
Closed
Labels
bug Oh no, something's broken :-(

Comments

@terebentina
Copy link

I am calling DayPickerRangeController like this:

              <DayPickerRangeController
                startDate={this.state.customIntervalStart}
                endDate={this.state.customIntervalEnd}
                onDatesChange={this.onCustomDatesChange}
                focusedInput={this.state.focusedInput}
                onFocusChange={this.onDatePickerFocusChange}
                minimumNights={0}
                keepOpenOnDateSelect={false}
                renderCalendarInfo={() => (
                  <CalendarInfo onClick={this.onClearDatesClick} className={styles.calendarInfo} />
                )}
              />

It used to be fine until react-dates 12.2.0. With every 12.2 so far I am now getting

Uncaught TypeError: props.initialVisibleMonth is not a function
    at new DayPicker (DayPicker.js:555)

Am I supposed to specify initialVisibleMonth in DayPickerRangeController now? The docs still say it's optional.

@csi-lk
Copy link

csi-lk commented Jul 5, 2017

Same issue here but slightly different error message:

Uncaught (in promise) TypeError: props.initialVisibleMonth is not a function
    at new DayPicker (DayPicker.js:555)
    at ReactCompositeComponent.js:294
    at measureLifeCyclePerf (ReactCompositeComponent.js:75)
    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (ReactCompositeComponent.js:293)
    at ReactCompositeComponentWrapper._constructComponent (ReactCompositeComponent.js:279)
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:187)
    at Object.mountComponent (ReactReconciler.js:45)
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:370)
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:257)
    at Object.mountComponent (ReactReconciler.js:45)

@aleib
Copy link
Contributor

aleib commented Jul 5, 2017

Same issue. As mentioned by terebentina specifying the initialVisibleMonth removes the error.
So something like:
initialVisibleMonth={() => moment()}

aleib added a commit to aleib/react-dates that referenced this issue Jul 5, 2017
@majapw majapw added the bug Oh no, something's broken :-( label Jul 6, 2017
@majapw
Copy link
Collaborator

majapw commented Jul 6, 2017

Thanks for the catch! I commented on the PR. :)

majapw pushed a commit to aleib/react-dates that referenced this issue Jul 7, 2017
majapw added a commit that referenced this issue Jul 7, 2017
Fix for initialVisibleMonth in DayPickerRangeController (#613)
@majapw
Copy link
Collaborator

majapw commented Jul 7, 2017

Fixed in v12.2.4!

@majapw majapw closed this as completed Jul 7, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Oh no, something's broken :-(
Projects
None yet
Development

No branches or pull requests

4 participants