dayjs
dayjs copied to clipboard
can't parse string without year,month and day like '18:40:44'
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,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
https://day.js.org/docs/en/parse/string-format This dependent on CustomParseFormat plugin to work
You should use
dayjs('10:12', 'HH:mm').isBefore( dayjs('10:13', 'HH:mm') )