iamkun / iamkun/dayjs

Year + Week wrong calculation

Open
#2,539 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Using dayjs setting year and week brings wrong date

**Expected behavior**
Setting dayjs().year(2024).week(1) should give you a day in the first week of 2024. It gives you a day in 2025 instead.
Everything returns cool if you reset the month (e.g. dayjs().year(2024).startOf('year').week(1))

**Information**
- Day.js Version: v1.11.10
- OS: Ubuntu
- Browser: Firefox 120.0.1 (64 bit)
- Time zone: GMT+01:00 (Rome)

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Reproduce the exact dayjs().year(2024).week(1) chain, compare it with the startOf('year') example, and trace the year and week calculations; done means the first-week result is correct and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.