Setting the timezone changes date's unix time
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
It appears that my local time zone's DST affects absolute time of the Dayjs object.
```
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
dayjs.extend(utc);
dayjs.extend(timezone);
const a = dayjs('2025-10-26T04:00:00.000Z');
const b = dayjs('2025-10-26T04:00:00.000Z').tz('America/New_York');
// getting `false` to all of these comparisons, but I expect them all to be `true`.
console.log(a.valueOf() === b.valueOf());
console.log(a.unix() === b.unix());
console.log(a.toISOString() === b.toISOString());
```
**Information**
- Day.js Version: 1.11.18
- Browser: Chrome 141.0.7390.55 (Official Build) (arm64)
- Time zone: UTC +2 CEST (Europe/Warsaw)
Contributor guide
Research direction
Start by running the provided reproduction with the utc and timezone plugin entry points. Inspect how .tz('America/New_York') affects valueOf(), unix(), and toISOString() around the DST transition. Done means all three comparisons preserve the same absolute instant while retaining the converted display timezone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100