question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

After update from version 0.40.0 calendar not update selected date

See original GitHub issue

Calendar display old selected date if i put new selected prop to calendar.

<DatePicker
        ref={this.onDatePickerRef}
        openToDate={this.state.openDate}
        onMonthChange={this.onMonthChange}
        customInput={<SelectedDate/>}
        popoverTargetOffset='0 0'
        dateFormat={isSelectedCurrentYear ? DATE_FORMAT_FOR_CURRENT_YEAR : DATE_FORMAT}
        dateFormatCalendar='MMMM'
        {...this.props}
        selected={this.state.selectedDate}
        onChange={this.onSelectedDateChange}
        filter={this.datesFilter}
        forceShowMonthNavigation={true}
      >
        <YearsSelector onChange={this.onYearChange} year={this.state.openDate.year()}/>
      </DatePicker>

prev selected date 01 april image

prev selected date 30 april image

How you seen. On filter prop calendar reacts and disable days

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
JorgenEvenscommented, Jun 10, 2017

We are seeing something similar in our application.

Perform a click anywhere else on the page will cause the calendar to update correctly.

Steps to reproduce:

  • Go to the inline example
  • Select a any date on the calendar
  • Navigate a few months into the future
  • Select another date

Expect: The future date is selected and highlighted

Actual: The calendar switches back to the old date ( but does not highlight it ). Clicking on a different date after this point will only toggle between the last two dates.

Workaround:

Calling setOpen after the component has been rendered seems to correctly select the date. This is also happening in the onClickOutside handler, which explains why clicking anywhere else fixes the issue.

<DatePicker inline={true} ref={r => r && r.setOpen(false)} selected={selectedDate} />
2reactions
JorgenEvenscommented, Jun 27, 2017

@alex-shamshurin So what you are suggesting is that the behaviour on the inline example is intended behaviour?

To be clear I was literally using the component as specified earlier (<DatePicker inline={true} selected={selectedDate} />), not setting openToDate to any value at all when I ran into this issue.

If this is intended I think that the example should be fixed and the documentation should clearly state how inline should be used, because at this point even your explanation confuses me on the purpose of openToDate in the context of an inline calendar.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modified react-datepicker not showing value - Stack Overflow
I've successfully modified the codes but whenever I click on the selected date, it's not showing any date at all. Here's what my...
Read more >
shared calender not up to date - Microsoft Q&A
Since Office 2021 we have many complains that shared calender not up to date! users must always update manually - why!
Read more >
react-date-picker-field - npm
A simple and reusable datepicker component for React. Latest version: 0.1.2, last published: 5 years ago.
Read more >
Release Notes | Mimestream
Labs Snooze feature got disabled on upgrade to 0.40.0 ... Version 0.40.0 ... Windows don't open on macOS Catalina after the beta build...
Read more >
Unable to establish secure connection wrong version number
Subscribe to RSS Feed; Mark Topic as New; ... Some servers don't like it if the time is wrong or esp if on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found