Cloning a date with a timezone without offset results in a different date
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
First of all, thanks for the great library! We’ve found a bug when cloning a date with a timezone without offset. This can easily be replicated with the following test:
```javascript
it('clone retains date and timezone for timezone without offset', () => {
const instance = dayjs('2022-01-01T03:00:00.000Z').tz('Europe/London')
const another = instance.clone()
expect(another.format()).toEqual(instance.format())
})
```
After cloning, the date is not the same as the original one:
```
Expected value to equal:
"2022-01-01T03:00:00Z"
Received:
"2021-12-31T14:00:00Z"
```
**Expected behavior**
Cloning should not change the date when a timezone without offset is used.
**Information**
- Day.js Version v1.11.7
- OS: Linux
- Browser NodeJS
- Time zone: WET +00:00
Contributor guide
Assessment
This issue has not been assessed yet.