iamkun / iamkun/dayjs

Incorrect week() for UTC time zone

Open
#2,881 1 comment 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**
Weeks for UTC time zone (+0) seem to be off.
May 22nd is Thursday, 21st ISO week.
```
console.log(dayjs.tz.guess()) // Europe/Amsterdam
console.log(dayjs('2025-05-22T12:00:00Z').tz('America/New_York').week()) // 21
console.log(dayjs('2025-05-22T12:00:00Z').tz('UTC').week()) // 25
console.log(dayjs('2025-05-22T12:00:00Z').tz('Portugal').week()) // 25
console.log(dayjs('2025-05-22T12:00:00Z').tz('Europe/Riga').week()) // 21
```

**Expected behavior**
Regardless of the time zone, week number should be 21 in this case and certainly not 4 weeks off.

**Information**
- Day.js Version: 1.11.13
- OS: Debian 12 x86_64
- Browser Brave 1.78.102 Chromium: 136.0.7103.113 (also tested in node v22.15.0 and on Firefox)
- Time zone: Europe/Amsterdam

P.S. Thanks for your kind work.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the provided dayjs.tz and week() calls, then trace the timezone and week-number entry points implementing those APIs. Compare UTC, Portugal, and Riga with the expected ISO week 21, and finish with a regression check showing equivalent zones return the correct result.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.