iamkun / iamkun/dayjs

dayjs.tz(datetimeStrWithOffset) changes local date time with the same offset

Open
#1,265 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**
`dayjs("2020-11-24T02:55:43+09:00").format()` returns `2020-11-24T02:55:43+09:00`
`dayjs.tz("2020-11-24T02:55:43+09:00").format()` returns `2020-11-23T17:55:43+09:00`

**Expected behavior**
`dayjs.tz("2020-11-24T02:55:43+09:00").format()` should return `2020-11-24T02:55:43+09:00`, same as `dayjs("2020-11-24T02:55:43+09:00").format()`

**Information**
- Day.js Version: 1.9.7
- OS: Windows 10 19041.630
- Browser: Chrome 87.0.4280.88 (Official Build) (64-bit)
- Time zone: GMT+09:00

Contributor guide

Open the contributing guide

Research direction

Reproduce the two formatting examples from the issue, then trace the dayjs.tz entry point and its timezone parsing behavior. Add a regression test covering an input datetime with an explicit +09:00 offset; done means the local date and time remain unchanged and the expected formatted output is returned.

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
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.