dayjs.utc(dayjs(), 'YYYY') is Invalid Date
Open
- 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
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