Daylight savings time inconsistent using Geographic TimeZone specifiers
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When I apply the same timezone to a timezone constructed dayjs object, it will fallback to standard time.
eg, daylight savings time ended on Nov 1st. Therefore 2020-10-30 14:00:00 in America/New_York should _always_ be `-0400`
It appears that the only correct call signature is `dayjs.tz("2020-10-30 14:00:00", "America/New_York")`
All other signatures seem to change to the current daylight savings state:
```
dayjs.tz("2020-10-30 14:00:00", "America/New_York").tz("America/New_York").format()
"2020-10-30T14:00:00-05:00"
dayjs(dayjs.tz("2020-10-30 14:00:00", "America/New_York")).tz("America/New_York").format()
"2020-10-30T14:00:00-05:00"
dayjs("2020-10-30 14:00:00").tz("America/New_York").format()
"2020-10-30T14:00:00-05:00"
```
**Expected behavior**
Any of the above calls to `tz(...).format()` should use the correct DST offset (`-0400` for New York), resulting in
```
"2020-10-30T14:00:00-04:00"
```
**Information**
- Day.js Version v1.10.4
- OS: macOS 11.2
- Browser Chrome 88
- Time zone: GMT-05:00 Eastern standard time
Contributor guide
Research direction
Start by reproducing the listed tz(...) and .format() calls for America/New_York, then trace the timezone conversion path used by those entry points. Done means every shown signature preserves the historical -04:00 offset for 2020-10-30 14:00:00 rather than applying the current standard-time offset.
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
- Mostly clear
- Newbie friendliness
- 35/100