iamkun / iamkun/dayjs

weekOfYear week number calculation use Sunday as week start even with another locale

Open
#2,237 5 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**

```js
import dayjs from 'dayjs'
import 'dayjs/locale/hu'
import weekOfYear from 'dayjs/plugin/weekOfYear'

dayjs.extend(weekOfYear)
dayjs.locale('hu')

const currentDate = dayjs()
const weekNumber = currentDate.week()
```
This gives me `7` today. Today is Sunday, and for Hungarian locale the first day of the week is Monday.

**Expected behavior**
The `weekNumber` should be `6` on this Sunday.

**Information**
- Day.js Version 1.11.7
- OS: Manjaro
- Browser Brave 1.48.158
- Time zone: (GMT+1)

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.