iamkun / iamkun/dayjs

When Local Clock set to 12AM hour, Chrome returns incorrect TZ values

Open
#1,035 6 comments 0 reactions 0 assignees View on GitHub
☢️Bug
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Steps:
1. set your local clock time on your machine to the 12AM hour
2. have a script that loads dayjs and extends utc & timezone
3. open firefox and run command in console:
4. open chrome or MS edge and run the same command in console
```
dayjs
.tz(
dayjs().format('YYYY-MM-DD HH:mm'), // get local date and time
'America/Los_Angeles'
)
.day(2) // set it to Tuesday
.hour(23) // set the hour late in the day
.minute(1) // set some random minute
.tz('America/Chicago') // now convert it to a tz for the next day (should be wednesday)
.format(`dddd h:mm A [America/Chicago]`);
```

**Expected behavior**
- The day should be set to Wednesday when converting, but Chrome is saying it's Tuesday.
- Issue does not happen outside of the 12:00-12:59AM window

![Developer_Tools_-_Tuesday_2_52_AM_America_Chicago_-_http___localhost_7177_time-converter_day_2_month_8_hour_23_minute_28_tz_93_otz_51_and_DevTools_-_localhost_7177_time-converter_day_2_month_8_hour_23_minute_28_tz_93_otz_51_and_Date___Time_](https://user-images.githubusercontent.com/38116726/92456258-8ac83400-f177-11ea-8842-df30d3eacfdf.jpg)

**Information**
- Day.js Version: 1.8.35
- OS: MacOS Catalina 10.15.6
- Browser:
- Failing Chrome Based browsers:
- Chrome 85.0.4183.83
- MS Edge 85.0.564.44
- Succeeds in Firefox:
- Firefox 80.0.1
- Time zone: GMT-07:00 DST (Pacific Daylight Time)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.