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

Handle Parsing Fail Better Than Setting to Dec. 30 1899 #527

Open
RyanTankersley opened this issue May 12, 2016 · 2 comments
Open

Handle Parsing Fail Better Than Setting to Dec. 30 1899 #527

RyanTankersley opened this issue May 12, 2016 · 2 comments

Comments

@RyanTankersley
Copy link

I want to set a predefined format, but I also want users to be able to manually input values.

Here is what happens currently if the user puts in values that do not match the predefined format (mine is mm/dd/yy HH:ii P in this example):

image

The same happens if they put in junk. "asdf" for example.

image

I have created a pull request #526 to fix this issue. If all else fails, it will use new Date(input). If that fails to, it will return new Date().

image

image

@RyanTankersley
Copy link
Author

I realized the logic for this actually made sense. It is setting it to the minimum date. It gave that weird date because there was no minimum date set.

@RyanTankersley
Copy link
Author

Sorry, I'm going to go ahead and open it up and let you decide. If a date is parseable by new Date(). It may be best to let it happen. Perhaps, however, returning the current day versus the min date if parsing fails is up in the air.

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

No branches or pull requests

1 participant