victorjonsson / jQuery-Form-Validator

[DISCONTINUED] jQuery plugin that makes it easy to validate user input while keeping your HTML markup clean from javascript code.
972 stars 476 forks source link

How validate two dates Initial and final #637

Open joefreire opened 7 years ago

joefreire commented 7 years ago

Hi everyone,

how i can validate two dates: initial and final

i have this inputs

and

how i can set DataFinal can't be > DataInitial and DataInitial can't be < DataFinal

Thanks

victorjonsson commented 7 years ago

It's not supported at the moment. But I think it's a great feature that should be provided by the date module. The use of the validator could look something like:

Begin date:
<input name="initial" data-validation="date" id="initial-date" />

Final date:
<input name="final" 
    data-validation="date dateAfter" 
    data-validation-date-compare="#initial-date">

<input data-validation="dateAfter|dateBefore" data-validation-compare="[QUERY_SELECTOR]">