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.

[DatePicker] - Wrong month names with preset value

See original GitHub issue

Description

When a value or a default value is set on the component with a date turning point the date selector shows wrong month names.

Here is an example. I’m in GMT+1 and if I set the value to new Date(2017, 10, 21, 0, 0, 0) the following happens:

  • The input field and the calendar sidebar will show 11/20/2017 selected correctly and the calendar title will show November 2017
  • Clicking on the next month selector the calendar title will still show November 2017 but the days and weeks will change
  • Clicking on the previous month selector the calendar title will show October 2017, but the days and weeks will actually show November
  • Selecting a date will pick the correct value

By setting the value to new Date(2017, 10, 21, 2, 0, 0) this issue is not reproducible.

I’ve also noticed the following two issues:

  • The days within the months are shown incorrectly, e.g. November starts with the date 30 and ends with the date 30
  • The current date is shown correctly in the sidebar but incorrectly in the calendar, the previous day is highlighted as the current date and is selected by default

Version

  • React - 16.1.1
  • React-MD - 1.2.8
  • Browser - Reproducible on Chrome, Safari, Firefox, Opera

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
tanmay-gpcommented, Jan 23, 2018

@mlaursen any update on this one?

3reactions
mlaursencommented, Jan 5, 2018

Here’s a little update for this issue:

I had to make a different DatePicker for work that has solved most of the date problems that we are seeing here and are finishing QA on them by next Thursday. Once it is done with QA, I’ll start working on moving the correct logic into here. I’m hoping I can get the date fixes into a patch instead of a major/minor release, but if it can’t I’ll put them in the 1.3.0 release. In 2.0.0 or 1.3.0 I’ll also be adding some newer Date, Time, and DateTime pickers that will allow for text input as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DatePicker shows wrong value of month - Stack Overflow
If you have an array with the names of the months, you want the months to be zero indexed to match with this...
Read more >
Datepicker is passing wrong values - WordPress.org
Hi,. The datepicker is showing when I press on the input field, but it is passing wrong values. I want to display some...
Read more >
jQuery UI Datepicker
The jQuery UI Datepicker is a highly configurable plugin that adds datepicker functionality to your pages. You can customize the date format and...
Read more >
Datepicker Is Returning Wrong Month (showing the month selec
Expected behavior I am using using Datepicker for the first time. The pop up is working as expected. When I click on a...
Read more >
Datepicker in Angular using mat-datepicker | Material Design
Instead of that if we want to set the view to current year we can use startView property of mat-datepicker . Allowed values...
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