iamkun / iamkun/dayjs

Day.js with timezone feature shows different times on client and server side.

Open
#2,478 0 comments 3 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.