iamkun / iamkun/dayjs

Poor documentation or bug with local time display as string

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

Description

`console.log(dayjs())`

...
$M
$W
$d: Tue Nov 30 2021 19:17:28 GMT+0530 (India Standard Time)
$m
...

`console.log(dayjs().toString())`

Tue, 30 Nov 2021 13:47:28 GMT

Huh? Calling [Now](https://day.js.org/docs/en/parse/now) shows local time, and calling [As String](https://day.js.org/docs/en/display/as-string) on Now mysteriously turns it into GMT.

So how is one supposed to get a string of the local time?

Contributor guide

Open the contributing guide

Research direction

Start with the linked Now and As String documentation pages and reproduce both console.log examples in a local Day.js setup. Trace the documented behavior of toString and local-time formatting, then update the relevant documentation or add a focused regression test so the expected local-time string behavior is explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.