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.

Expected behavior

I’m using Moment.js and react-datepicker.
Also I use YYYY-MM-DD for both packages.

For the same date Moment.js gives me 2019-02-08
react-datepicker gives me 2019-02-39

<DatePicker
  selected={this.state.tempDate}
  showTimeSelect={false}
  className="form-control"
  dateFormat="YYYY-MM-DD"
  placeholderText="Add date to exclude"
  onChange={date => this.setTempDate(date)}
/>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ArtemBernatskyycommented, Feb 15, 2019

@markokosir the problem is in inconsistency.

Date is the same but dateFormat differs from moment.js - which is very bad.

1reaction
mvenaascommented, Feb 8, 2019

I downgraded from v2.0 to v1.8 and continued with Moment.js while in search for a better solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java's SimpleDateFormat: YYYY vs yyyy - Dan Goldin
They both represent a year but yyyy represents the calendar year while YYYY represents the year of the week. That's a subtle difference...
Read more >
Difference between 'YYYY' and 'yyyy' in NSDateFormatter
A common mistake is to use YYYY. yyyy specifies the calendar year whereas YYYY specifies the year (of “Week of Year”), used in...
Read more >
YYYY vs yyyy - The day the Java Date Formatter hurt my ...
The Difference between y and Y · y (lowercase) is year · Y (uppercase) is 'week-based-year'.
Read more >
Java's SimpleDateFormat: YYYY vs yyyy | by Dan Goldin
They both represent a year but yyyy represents the calendar year while YYYY represents the year of the week. That's a subtle difference...
Read more >
Swift understanding yyyy vs YYYY iOS DateFormatters
A common mistake is to use YYYY. yyyy specifies the calendar year whereas YYYY specifies the year (of “Week of Year”), used in...
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