iamkun / iamkun/dayjs

isoWeek() ignores artificially set timezone

Open
#1,655 2 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**
isoWeek() returns the correct result for the local timezone but not when using an arbitrary dayjs object with a timezone set.

![image](https://user-images.githubusercontent.com/1375586/135769752-6c8eed98-aee0-4ff4-b500-9f4a23ed93bc.png)

On the first call, I had my timezone manually set to glascow/utc. One the second call, it's a local timezone of Paris.
`36` is correct, `35` is not. My understanding is that since a `tz` is set on the dayjs instance, the local timezone should not matter?

**Expected behavior**
It should always return the isoWeek for the set timezone.

**Information**
- dayjs `1.10.7`
- Latest chrome

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue described in #1655 with a Day.js object whose timezone is set, comparing isoWeek() in UTC/Glasgow and Paris. Trace the isoWeek and timezone entry points to find where the local timezone affects the result. Done when isoWeek() uses the instance's configured timezone, with a regression test covering the differing zones.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.