iamkun / iamkun/dayjs

The year is not parsed correctly in Russian localization with CustomParseFormat

Open
#2,743 0 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**
When a date is parsed from text starting from the month of December, the year is parsed as +1 to the year.
```
import dayjs from "dayjs";
import customParseFormat from 'dayjs/plugin/customParseFormat';
import "dayjs/locale/ru";

dayjs.extend(customParseFormat);

console.log(dayjs("01 декабря 2024", "DD MMMM YYYY", 'ru').year()); // 2025
```

**Expected behavior**
The year should be parsed correct:
```
console.log(dayjs("01 декабря 2024", "DD MMMM YYYY", 'ru').year()); // 2024
```

**Information**
- Day.js Version: 1.11.13
- OS: Windows
- Browser: Edge 129.0.2792.79
- Time zone: GMT+3

Contributor guide

Open the contributing guide

Research direction

Start by running the provided CustomParseFormat example with the Russian locale and inspect the customParseFormat plugin together with dayjs/locale/ru. The fix is complete when parsing "01 декабря 2024" with "DD MMMM YYYY" returns year 2024 rather than 2025.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.