Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customParseFormat: added logic to parse the week day #576

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

waseemahmad31
Copy link
Contributor

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
Copy link
Contributor Author

test case failing with moment 2.24.0.

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

@BePo65
Copy link
Contributor

BePo65 commented Jun 2, 2022

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants