[timezone] wrong `toISOString()` value with zone conversion and DST
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
```js
// 'Europe/Vilnius' timezone => GMT+2, DST+1
// zone initialization - ok
dayjs.tz('2022-01-01T00:00:00.000Z', 'Europe/Vilnius').format()
// OUTPUT: '2022-01-01T00:00:00+02:00' ✅
dayjs.tz('2022-01-01T00:00:00.000Z', 'Europe/Vilnius').toISOString()
// OUTPUT: '2021-12-31T22:00:00.000Z' ✅
// zone conversion - fails
dayjs.utc('2021-12-31T22:00:00.000Z').tz('Europe/Vilnius').format()
// OUTPUT: '2022-01-01T00:00:00+02:00' ✅
dayjs.utc('2021-12-31T22:00:00.000Z').tz('Europe/Vilnius').toISOString()
// OUTPUT: '2021-12-31T23:00:00.000Z' ❌
// EXPECTED: '2021-12-31T22:00:00.000Z'
```
FIY: moment.js handles this properly.
**Information**
- Day.js `v1.10.7`
- OS: `macOS Big Sur`
Contributor guide
Research direction
Start by reproducing the timezone conversion with dayjs.utc(...).tz('Europe/Vilnius').toISOString() and compare it with the direct dayjs.tz(...) case shown in the report. Trace the timezone conversion and toISOString() entry points; done means the converted value matches the expected '2021-12-31T22:00:00.000Z' while formatted local output remains correct.
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
- 45/100