Validating date with javascript

Rated 3.90/5 based on 920 customer reviews

is an open source component of Wrapp and is licensed under the MIT license.There are no required external dependencies at all!Though for the datetime and date validator to you need to specify a parse and format function and for that you most likely will want to use a library, is highly recommended.If you want to use async validation you need to use a runtime that supports Promises.Description: This script validates a date field to ensure it's in the format mm/dd/yyyy.It also intelligently checks that the date ranges are valid, so something like 02/30/2005 is caught.

If you want to modify which values are considered empty for example you can simply overwrite You can find some basic examples included in the project.

Besides accepting all options as the non async validation function it also accepts two additional options; clean Attributes which, unless before resolving the promise and wrap Errors which can be a function or constructor that will be called with the errors, options, attributes and constraints if an error occurs.

This allows you to define a better way of catching validation errors.

The project can be found on Git Hub where you can also find our issue tracker.

There is also a Travis project used for testing, a Coveralls project used to code coverage as well as the annotated source.

Leave a Reply