dayjs
dayjs copied to clipboard
Polish locale date parsing returns 1 year more than expected
Describe the bug My goal was to parse a date. For e.g. '31 grudnia 1990'. The date is in format 'DD MMMM YYYY'.
grudnia is December in the English language. I imported the locale and set it globally as well as locally. Still whenever I parse the string, the dayjs object which I get is equivalent of the date 30 December 1991. Thus adding 1 year to the expected date. This happens only for December and not any other month. I checked a few other locales as well which I often encounter and only in Polish this issue is present.
Here is a playground for isolating the bug and can be checked across different version of the dayjs library.: https://stackblitz.com/edit/dayjs-playground-uzv6sk?file=index.js Expected behavior I would like to get the correct year to be returned which I get for other locales. So Ideally '31 grudnia 1990' would have returned 'Mon, 30 Dec 1990 23:00:00 GMT' instead of Mon, 30 Dec 1991 23:00:00 GMT
Information
- Day.js Version 1.11.10
- OS: Mac Sonoma 14.0, but the same bug reappears in other operating systems as well.
- Browser: Version 118.0.5993.88 (Official Build) (x86_64)
- Time zone: [e.g. GMT+01:00 (Central European Standard Time)]
This is most probably same as this https://github.com/iamkun/dayjs/issues/2511
@kavish5 i checke for ukrainian and russian as well in connection with #2511, found the same issue appears for ukrainian for me as well.
console.log(dayjs('31 грудня 1990', 'DD MMMM YYYY')); leads to 1991 as the year, same as polish