iamkun / iamkun/dayjs

dayjs().format('x') result output x characters

Open
#2,436 2 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**
Regarding the function of format('x'), the results obtained are inconsistent with expectations.
`dayjs('2023-09-01T08:12:16.468+00:00').format('x')`
output:x
`dayjs('2020-03-25T02:53:51.259Z')`
output:{$L: 'en', $d: Wed Mar 25 2020 10:53:51 GMT+0800 (中国标准时间), $x: {…}, $y: 2020, $M: 2, …}
`dayjs('2020-03-25T02:53:51.259Z').format('x')`
output:x
**Expected behavior**
Unix Timestamp in millisecond

**Information**
Day.js Version [1.11.9]
OS: [Mac OS 13.4]
Browser [Chrome Version 116.0.5845.110]
Time zone: [GMT +2]

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. First reproduce the two format('x') examples against Day.js 1.11.9, then trace the date-format token handling. Done means format('x') returns the Unix timestamp in milliseconds for both examples, with regression coverage added.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.