Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

fix(datepicker): Datepicker only accept text that matches format #3152

Closed
wants to merge 2 commits into from
Closed

fix(datepicker): Datepicker only accept text that matches format #3152

wants to merge 2 commits into from

Conversation

clockworked247
Copy link

fixes issue #2886

Added parseStrict param in parseDate function, which preserves use
of new Date() fallback in that function, but allows developer to
set parsing to strictly conform to dateFormat, otherwise returns
undefined.

fixes issue #2886
@jmayday
Copy link

jmayday commented Feb 13, 2015

HI. I just found this PR. Few days ago I prepared mine, very similar one (#3294). But I haven't added additional parameter strict-date. For now I would say it's redundant one because is there really a situation when we have some date format defined (and actually we always have, don't we?) but don't want date to be scrict-parsed? I just can't imagine such requirement.

@karianna
Copy link
Contributor

@clockworked247 - This fails in the travis build, can you update the PR?

@clockworked247
Copy link
Author

@karianna - Sure. Will do.

@clockworked247
Copy link
Author

@jmayday - I believe the changes are quite similar. I only added the param to preserve existing functionality, so if you think it's not necessary, I'm all for your change. Looking at the code, you're removing the fallback and relying on dateParser.parse(). That code appears to effectively do the same thing in returning undefined if the date is not valid. So that looks good to me.

@rvanbaalen
Copy link
Contributor

@clockworked247 The build is still failing. Can you please fix this PR?

@clockworked247
Copy link
Author

@rvanbaalen My understanding was that my PR was a duplicate of #3294, so I'm OK to just close this and let the issue be hashed out there. It seems it's under debate though.

I'm not really following why #3417 conflicts with the change. Considering we need to validate a date entered manually in the associated text field, it only makes sense to add this kind of change. Otherwise, the Date() fallback will just change the invalid date to some odd number that has nothing to do with what the user entered. Super confusing... We also wouldn't be able to do custom handling of invalid dates without it returning undefined for invalid dates.

Closing this, as it's a duplicate.

@rvanbaalen
Copy link
Contributor

Thanks for detecting the duplicate @clockworked247 👍

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

Successfully merging this pull request may close these issues.

4 participants