Wrong time in GMT timezones when locale is set
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
The following code:
```js
new dayjs(newDate())
.tz('Europe/London')
.locale('en')
.format('h:mm A');
```
Returns a time in EST (5 hours behind London, 3 hours ahead of me)
I'm located in California, not that that should matter here.
All other timezones that aren't in GMT time work **perfectly fine**
```js
new dayjs(newDate())
.tz('Europe/London')
.format('h:mm A');
```
Not setting the locale this works perfectly fine.
Please assist
**Expected behavior**
The correct time in London
**Information**
- Day.js Version ^1.10.7
- OS: Windows
- Browser: Chrome Version 97.0.4692.71 (Official Build) (64-bit)
- Time zone: GMT-08:00 PST (Pacific Standard Time)
Contributor guide
Research direction
Start by reproducing the reported snippet with Day.js 1.10.7, comparing Europe/London formatting with and without .locale('en') in the stated environment. Trace the timezone and locale formatting entry points, then verify that the London result remains correct when the locale is set and add coverage for this case if the existing test structure supports it.
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
- 35/100