'yyyy' vs 'YYYY'
See original GitHub issueExpected 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:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@markokosir the problem is in inconsistency.
Date is the same but
dateFormat
differs frommoment.js
- which is very bad.I downgraded from v2.0 to v1.8 and continued with Moment.js while in search for a better solution.