iamkun / iamkun/dayjs

Polish locale date parsing returns 1 year more than expected

Open
#2,483 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**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 199**0** 23:00:00 GMT' instead of Mon, 30 Dec 199**1** 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)]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.