iamkun / iamkun/dayjs

.weekYear() unexpectedly returns year (and not week)

Open
#1,392 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**
The weekYear() method is supposed to return the week of the year but instead it returns the year itself.

**Expected behavior**
When calling this method the following way: dayjs("2021-01-01").weekYear() it returns 2021, when the expected result would be the week of the year that day corresponds to, never the year

**Information**
- Day.js: ^1.10.3,
- Browser: Chrome 88.0.4324.150
- Time zone: UTC

Contributor guide

Open the contributing guide

Research direction

Start at the weekYear() entry point and reproduce the reported dayjs("2021-01-01").weekYear() result. Check the method's existing contract and surrounding date APIs, then establish whether the returned value matches the intended meaning and add or update coverage so the expected behavior is explicit.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.