iamkun / iamkun/dayjs

dayjs.utc(dayjs(), 'YYYY') is Invalid Date

Open
#2,519 1 comment 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

**Describe the bug**
console.log(dayjs.utc(dayjs(), 'YYYY'));

result

```
M
$D: NaN
$H: NaN
$L: "en"
$M: NaN
$W: NaN
$d: Invalid Date {}
$isDayjsObject: true
$m: NaN
$ms: NaN
$s: NaN
$u: true
$x: {}
$y: NaN

```

dayjs@1.11.10

Contributor guide

Open the contributing guide

Research direction

Start by running the reported dayjs.utc(dayjs(), 'YYYY') example against dayjs 1.11.10 and inspect the UTC and parsing entry points involved in that call. Trace how the existing date object and format argument are handled, then add a regression test defining the expected result before confirming the call no longer produces Invalid Date.

Written by the indexing model from the issue text.

Assessment

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