https://github.com/Hacker0x01/react-datepicker/issues/1767
+1
This problem is particularly annoying
It's rarely good to use an alpha version (date-fns v2.alpha https://github.com/Hacker0x01/react-datepicker/blob/master/package.json#L103)
@Darrken It wasn't possible to use the 1.x version of date-fns? (which would accept those older date formats, they are maybe non-standard but it helps a lot for a smoother transition, we have a lot of those date formats in DB, we can't migrate them all at once)
I'm trying with something hacky like this, but as you can see it's fragile:
// https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
// converts from moment which use non-standard formats, to date-fns use https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
const fixDateFns2Format = format => format
.replace('YYYY', 'yyyy') // full year
.replace(/\bDD\b/, 'dd') // day of month, short
.replace('dddd', 'cccc'); // day of week, long
Problem persists in 2.8.0. This error makes this library unusable until it's fixed. 鈽狅笍
Error: RangeError: Use yyyy instead of YYYY for formating years
+1
For now I ought to use the 2.4.... version of this package
+1
Still a problem in version 2.9.6
version 2.4.0 works as intended
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Problem persists in 2.8.0. This error makes this library unusable until it's fixed. 鈽狅笍
Error: RangeError: Use
yyyyinstead ofYYYYfor formating years