dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

dayjs('17:14:10', 'HH:mm:ss') gives invalid date

Open wrynsl2 opened this issue 2 years ago • 2 comments

const timeString = dayjs('17:14:10', 'HH:mm:ss') gives invalid date

Expected behavior It should parse partial string correctly as moment does

Information

Day.js: https://unpkg.com/[email protected]/dayjs.min.js OS: [windows] Browser [chrome 107.0.5304.63] Time zone: [GMT +8:00 ]

wrynsl2 avatar Apr 18 '23 09:04 wrynsl2

how to solve it?

Flcwl avatar Dec 26 '23 03:12 Flcwl

how to solve it?

use customParseFormat plugin

import dayjs from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat';

dayjs.extend(customParseFormat);

Zhangyao719 avatar Aug 01 '24 06:08 Zhangyao719