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

[feature] Support for strict formatless parsing #4611

Closed
wants to merge 1 commit into from
Closed

[feature] Support for strict formatless parsing #4611

wants to merge 1 commit into from

Conversation

thorn0
Copy link
Contributor

@thorn0 thorn0 commented May 4, 2018

Closes #2469

@jsf-clabot
Copy link

jsf-clabot commented May 4, 2018

CLA assistant check
All committers have signed the CLA.

@thorn0 thorn0 changed the title Support for moment(String, true) (strict parsing) [feature] Support for moment(String, true) (strict parsing) May 4, 2018
@coveralls
Copy link

coveralls commented May 4, 2018

Coverage Status

Coverage increased (+0.07%) to 94.718% when pulling abb347e on thorn0:parse-without-fallback-2469 into 2e2a5b3 on moment:develop.

@thorn0
Copy link
Contributor Author

thorn0 commented Aug 22, 2018

@marwahaha 🏓 Could you kindly review this PR and merge it if it's okay? 2469 is a really annoying issue.

@@ -192,10 +192,9 @@ export function configFromRFC2822(config) {
}
}

// date from iso format or fallback
// date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
export function configFromString(config) {
var matched = aspNetJsonRegex.exec(config._i);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pr adds moment support ASP.NET dates.
The variable is setup on line 45

var aspNetJsonRegex = /^/?Date((-?\d+)/i;
It is basically a regex that matches a string like this (random number):
/Date(9897979

Not a maintainer, just adding to the conversation.

} else {
// Final attempt, use Input Fallback
hooks.createFromInputFallback(config);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you enforce _strict for the InputFallback?
Will this cause breaking changes for other users. Who might not be using strict for their moment usage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have strict, then you'd have a format, and then you wouldn't do the fallback. So it is not breaking for existing users.

@yumetodo
Copy link

any updates?

@fleex
Copy link

fleex commented Mar 21, 2020

Any reason this hasn't been merged? It's almost 2 years and #2469 is reaaaaally annoying...

@ichernev
Copy link
Contributor

Merged in 022dc03

ichernev added a commit that referenced this pull request Apr 27, 2020
[feature] Support for strict formatless parsing
@ichernev ichernev changed the title [feature] Support for moment(String, true) (strict parsing) [feature] Support for strict formatless parsing Apr 27, 2020
@ichernev ichernev closed this Apr 27, 2020
marwahaha pushed a commit that referenced this pull request Sep 15, 2020
…4611 (#5574)

* Reflect changes from #4611 in ts3.1-typings

* Add types for `moment.utc(..., true)`
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.

Parse value without fallback
7 participants