Manipulate with utc0 time is wrong!
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
```js
dayjs('2022-01-23').utcOffset(0, true).format()
// print: 2022-01-23T00:00:00Z
dayjs('2022-01-23').utcOffset(0, true).add(1, 'minute').format()
// print 2022-01-22T16:01:00Z
// !!!
dayjs('2022-01-23').utcOffset(1, true).format()
// print 2022-01-23T00:00:00+01:00
dayjs('2022-01-23').utcOffset(1, true).add(1, 'minute').format()
// print 2022-01-23T00:01:00+01:00
```
**Expected behavior**
```js
dayjs('2022-01-23').utcOffset(0, true).add(1, 'minute').format()
// should print:
// print: 2022-01-23T00:01:00Z
```
**Information**
- Day.js Version 1.10.7
- OS: MacOs
- Browser chrome 96.0.4664.93
- Time zone: GMT+0800
Contributor guide
Research direction
Start by reproducing the utcOffset(0, true).add(1, 'minute').format() example from the issue, then trace the utcOffset and add entry points in Day.js. Done means the UTC offset-zero case formats as 2022-01-23T00:01:00Z without changing the behavior shown for offset 1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100