Inconsistent results on 25 hour day after time change
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
```javascript
const time = 1_762_066_800_000;
const timezone = 'US/Pacific';
const a = dayjs.tz(time, timezone)
.add(1, 'day');
const b = dayjs.tz(
dayjs.tz(time, timezone).add(1, 'day').valueOf(),
timezone
);
const c = dayjs.tz(
dayjs.tz(time, timezone).add(1, 'day').startOf('millisecond').valueOf(),
timezone
);
console.log('a', a.valueOf(), a.format('YYYY-MM-DD HH:mm:ss'));
console.log('b', b.valueOf(), b.format('YYYY-MM-DD HH:mm:ss'));
console.log('c', c.valueOf(), c.format('YYYY-MM-DD HH:mm:ss'));
```
Output:
```javascript
a 1762153200000 2025-11-03 00:00:00
b 1762153200000 2025-11-02 23:00:00
c 1762156800000 2025-11-03 00:00:00
```
**Expected behavior**
I expect all 3 results to be:
```javascript
a 1762156800000 2025-11-03 00:00:00
b 1762156800000 2025-11-03 00:00:00
c 1762156800000 2025-11-03 00:00:00
```
**Information**
- Day.js Version 1.11.19
- OS: MacOS 15.5
- Browser Node 22
- Time zone: US/Pacific
Contributor guide
Research direction
Start by running the supplied reproduction with Node 22 and Day.js 1.11.19, focusing on the dayjs.tz(), add(), valueOf(), and startOf('millisecond') paths around the US/Pacific time change. Done means all three results produce valueOf() 1762156800000 and format as 2025-11-03 00:00:00, with a regression test covering the case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100