expect(dayjs('2019-07-28').week()).toBe(30)
See original GitHub issueDescribe the bug
Since the introduction of locale.weekStart I expect it to work with e.g .week() plugin, but currently it doesn’t. 2019-07-28 is Sunday, so in en-gb locale it should be part of week 30, not week 31.
In Jest syntax:
require('dayjs/locale/en-gb')
dayjs.locale('en-gb')
expect(dayjs('2019-07-28').week()).toBe(30)
throws:
Expected: 30
Received: 31
Information
- Day.js Version:
1.8.15 - OS: MacOS
- Browser Chrome 76
- Time zone: Stockholm
UPD: attaching a screenshot of my WeekNumberAware calendar:

Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Add
Returns a cloned Day.js object with a specified amount of time added. ... When decimal values are passed for days and weeks, they...
Read more >Time from now
Range Key Sample Output
0 to 44 seconds s a few seconds ago
45 to 89 seconds m a minute ago
90 seconds to 44 minutes...
Read more >Format
List of all available formats ; d, 0-6, The day of the week, with Sunday as 0 ; dd, Su-Sa, The min name...
Read more >Start of Time
Returns a cloned Day.js object and set it to the start of a unit of time. dayjs().startOf('year'). Units are case insensitive, and support...
Read more >Subtract
Returns a cloned Day.js object with a specified amount of time subtracted. ... When decimal values are passed for days and weeks, they...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I will be working on this. Thanks for finding this problem.
Also, for proper testing - loop over few years of days and compare momentjs and dayjs. There are edge cases around year start that I didn’t manage to fix.
Example of how I tested it: https://github.com/NaturalCycles/time-lib/blob/master/src/plugin/weekOfYear.test.ts