iamkun / iamkun/dayjs

Broken format "MMMM" while using local with option "weekStart"

Open
#2,499 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**
Make a minimal setup like:
```javascript
import dayjs from "dayjs";

dayjs.locale("en", {weekStart: 1}); // cause {weekStart: number}

conole.log(dayjs().format("MMMM"))
```

[Here is the playground](https://codesandbox.io/s/issue-dayjs-local-weekstart-broken-format-mmmm-zdkvt7) with the sample code.

**Expected behavior**
There are no syntax errors.
The current month is displayed as `November`.

**Information**
- Day.js Version: v1.11.10
- OS: macOS Big Sur v11.7.8
- Browser: Chrome Version 119.0.6045.105 (Official Build) (x86_64)
- Time zone: GMT+1 Europe/Berlin

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in the linked CodeSandbox with the locale configured with weekStart: 1, then trace the related locale and format behavior in the repository. The fix is done when formatting with "MMMM" produces the current month name without syntax errors under that configuration, with a regression check if the project has an applicable test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.