dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

customParseFormat: added logic to parse the week day

Open waseemahmad31 opened this issue 6 years ago • 2 comments

Resolves issue #571

import customParseFormat from 'dayjs/plugin/customParseFormat'; dayjs.extend(customParseFormat);

var fmt = 'dddd DD MMMM HH:mm';

var d = dayjs('Tuesday 16 January 18:00', fmt); // works fine: d.isValid() is true

d = dayjs('Monday 15 January 18:00', fmt); // works fine: d.isValid() is true

d = dayjs('Saturday 20 January 18:00', fmt); // works fine: d.isValid() is true

waseemahmad31 avatar Apr 20 '19 09:04 waseemahmad31

test case failing with moment 2.24.0.

I have checked with moment 2.5.1. It's working. https://jsfiddle.net/pkje2y6z/

waseemahmad31 avatar Apr 20 '19 09:04 waseemahmad31

What would be the use of parsing the weekday?

Wouldn't it be better to parse variable length text (e.g. the name of a weekday) like in issue #571 ?

BePo65 avatar Jun 02 '22 15:06 BePo65