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

Throw an error for invalid date format #26

Merged
merged 14 commits into from Jan 14, 2017
Merged

Throw an error for invalid date format #26

merged 14 commits into from Jan 14, 2017

Conversation

waitingcheung
Copy link
Contributor

When an invalid date format is passed to the validator, calling get returns undefined and if it is further passed to the function date_with_format_array the following error occurs.

TypeError: Cannot read property 'length' of undefined
    at Object.date_with_format_array (file:///path/fieldval.js:902:44)

I check if format_array is an array in the function date_with_format_array first to prevent such problem.

MarcusLongmuir and others added 14 commits January 16, 2015 18:21
Parsing of integers and floats
Integrated DateVal and updated error numbers
BasicVal email, url and date improvements
Changed error structure to use only "invalid"
Fixed check reuse bug and docs updates
Added parameters to errors
Fixed emitting from .multiple check
Replaced second existing_error argument with options
Fixed issue with null in one_of check
@MarcusLongmuir
Copy link
Contributor

Hi @waitingcheung

Thanks for finding this issue! This PR served as a great starting point and made me realise that a date_format_array check would be rather useful to use as validation for the date_with_format_array check you added. I've raised #27 with my implemenation, but I'm happy to discuss other ways of implementing this that might be better for your use case.

Happy to merge yours first onto develop and then mine on top to give you the deserved contributions.

@waitingcheung
Copy link
Contributor Author

@MarcusLongmuir The changes look good to me. You may proceed with the merging.

@MarcusLongmuir MarcusLongmuir changed the base branch from master to develop January 14, 2017 14:29
@MarcusLongmuir MarcusLongmuir merged commit c64dd0d into FieldVal:develop Jan 14, 2017
@waitingcheung waitingcheung deleted the dateformat branch January 14, 2017 15:39
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.

None yet

3 participants