iamkun / iamkun/dayjs

Incorrect ISO Week Calculation

Open
#2,540 3 comments 2 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
When using startOf and endOf functions for the ISO week in Day.js version 1.11.10, the resulting dates are incorrect. Specifically, for week 52 of the year 2023, the expected output should be from December 25th to December 31st, but the actual output is from December 26th to January 1st.

## Expected behavior
The startOf and endOf functions for the ISO week should correctly return the start and end dates of the specified week. For week 52 of 2023, it should output December 25th (Monday) as the start date and December 31st (Sunday) as the end date.

## Information

Day.js Version: 1.11.10
OS: MacOS
Browser: Version 1.21.2 (44530)
Time zone: GMT-05:30 IST

## Steps to Reproduce

Use Day.js version 1.11.10.
Call the startOf('isoWeek') and endOf('isoWeek') functions for week 52 of the year 2023.
Actual Results
The output is December 26th to January 1st instead of December 25th to December 31st.

## Code

Playground - https://stackblitz.com/edit/dayjs-playground-s476mq?file=index.js

## Screenshot

image

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and trace the startOf('isoWeek') and endOf('isoWeek') behavior in Day.js. Verify the ISO week 52, 2023 result against the expected December 25–31 range; done means both boundaries return those dates without breaking related week calculations.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.