iamkun / iamkun/dayjs

Misparsing strings

Open
#2,146 0 comments 0 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**
DayJS is misparsing a string. Specifically `okt. 2022` is being parsed as `January 1 2022`. This is from a Danish language data set, but all other months (fx `jan` and `maj`) parse correctly.

The Danish language locale file seems correct to me if you need more examples of different spellings: https://github.com/iamkun/dayjs/blob/dev/src/locale/da.js

**Expected behavior**
I'd expect `okt. 2022` to be recognised as `October 1 2022` :)

**Code to recreate**
```javascript
import dayjs from "dayjs";

console.log(
"Expected behaviour (en)",
"oct. 2022",
dayjs("oct. 2022").toDate()
);

console.log(
"Unexpected behaviour (dk/da)",
"okt. 2022",
dayjs("okt. 2022").toDate()
);
```

**Information**
- Day.js Version 1.11.5 / 1.0.0 / 1.8.5
- OS: Browser: Big Sur Node: Big Sur & Ubuntu on docker idk what version but probably lates
- Browser Chrome Latest public release
- Time zone: CET

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.