iamkun / iamkun/dayjs

getWeekOfYear changes week number on Sunday - is this ISO?

Open
#2,433 3 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**
Calling `getWeekOfYear("2023-08-28")` returns 35, I would have expected 34.

It all comes down to whether we consider when the week starts, and I thought the ISO standard was to start on Monday.
Am I wrong?

I don't necessarily want things to change, but I wondered whether it was a bug, and will this behavior ever change, or can it be related to the device (browser locale, etc.)

Contributor guide

Open the contributing guide

Research direction

Start with getWeekOfYear and the date 2023-08-28; verify the week-start and locale assumptions behind the returned value. Done means the expected behavior is decided—ISO Monday-based or current behavior—and that decision is reflected in the relevant API guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.