Day.js with timezone feature shows different times on client and server side.
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
This bit of code, when executed on the server and the client side shows different results.
```
import dayjs from 'dayjs';
import utc from "dayjs/plugin/utc"
import timezone from "dayjs/plugin/timezone";
dayjs.extend(utc)
dayjs.extend(timezone)
const date = dayjs.utc("2023-10-11T18:13:00.000Z").tz("Africa/Cairo").format();
// On node.js: 2023-10-11T20:13:00+02:00
// On browser: 2023-10-11T21:13:00+03:00
```
**Expected behavior**
I think the node version is not taking Daylight savings into account. It should show the same time.
**Information**
- Day.js Version 1.11.6
- OS: Windows
- Browser [Edge 114]
- Time zone: IST
Contributor guide
Research direction
Start by reproducing the provided Day.js snippet in Node.js and Edge, using the stated Day.js version and Africa/Cairo timezone. Compare the runtime timezone data and formatted output; done means both environments produce the same expected time, with a regression test covering the discrepancy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- full-stack
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100