Skip to content

DayPickerSingleDateController Jump to current month on date prop change #1320

@amaury1093

Description

@amaury1093

Here's my simple component

    <DayPickerSingleDateController
      date={getDateFromUrl(this.props.router)}
      focused
      numberOfMonths={1}
      onDateChange={console.log}
      onFocusChange={noop}
    />

My URLs are in the format /date/${yyyy}/${mm}/${dd}, and the getDateFromurl("") function just transforms the URL into a momentObject.

Repro:

  • Load page /date/2017/01/01, the DayPickerSingleDateController will highlight Jan 1st 2017.
  • Navigate client side (i.e. no page refresh) to /date/2018/01/01

Expected result:

  • DayPickerSingleDateController changes its visible month to Jan 2018

Actual result:

  • DayPickerSingleDateController stays as Jan 2017.
  • Jan 1st 2017 gets un-highlighted (this is good)
  • If I manually scroll to Jan 2018, I see Jan 1st 2018 being hightlighted (which means the date prop has correctly been changed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestI want a new feature in react-dates!pull request wantedThis is a great way to contribute! Help us out :-D

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions