iamkun / iamkun/dayjs

can't parse string without year,month and day like '18:40:44'

Open
#1,261 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

**Describe the bug**
```
dayjs('18:40:44', 'HH:mm:ss')
// Invalid Date
```
when I use dayjs from node_modules,it can't parse the string
**Expected behavior**
but when I run this code in console of [dayjs](https://dayjs.gitee.io/docs/zh-CN/plugin/object-support),I can get the true answer.
```
dayjs('18:40:44', 'HH:mm:ss')
d {$L: "en", $u: undefined, $d: Tue Dec 08 2020 18:40:44 GMT+0800 (中国标准时间), $y: 2020, $M: 11, …}
$D: 8
$H: 18
$L: "en"
$M: 11
$W: 2
$d: Tue Dec 08 2020 18:40:44 GMT+0800 (中国标准时间) {}
$m: 40
$ms: 0
$s: 44
$u: undefined
$y: 2020
__proto__: Object
```

**Information**
- Day.js 1.9.6
- OS: Macos
- Browser Chrome 87
- Time zone: +8

Contributor guide

Open the contributing guide

Research direction

Start by reproducing dayjs('18:40:44', 'HH:mm:ss') with Day.js 1.9.6 in Node and compare it with the result shown in the Day.js console. Trace the string-format parsing entry point and its handling of missing date components; done means the input produces a valid date consistently with the documented behavior.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.