iamkun / iamkun/dayjs

UTC either +00:00 or Z when calling format() depending on runtime

Open
#1,509 5 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Not sure if this is a bug, but I'm trying to wrap my head around the behaviour. On nodeJS when I take a UTC date and format it it outputs the timezone as +00:00 - with the very same code (It's NextJS) on the client it outputs the timezone as Z. Why is this? (It's exposed through `Prop * did not match. Server: ..., Client: ...`)

**Expected behavior**
I would expect seeing `.format()` outputting `2021-05-29T18:00:00Z` or `2021-05-29T18:00:00+00:00` regardless of environment

**Information**
- Day.js Version: 1.10.4
- OS: Debian
- Node version: v14.17.0
- Browser: Microsoft Edge Version 90.0.818.66 (Official build) (64-bit)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the same Day.js 1.10.4 format() call in Node.js v14.17.0 and Microsoft Edge, using the UTC input and NextJS context described in the report. Compare why the output is +00:00 in one runtime and Z in the other; done means the behavior is explained and the issue's expected consistent output is addressed or documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
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.