Last active
June 21, 2016 23:58
-
-
Save carlosspohr/57f7b31e5695c5f2b77a6ab6a078ce00 to your computer and use it in GitHub Desktop.
Collection of useful jquery.validate methods.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.validator.addMethod("dateGreaterThan", function(value, element, params) { | |
var start = moment($(params).val(), "DD/MM/YYYY"); | |
var end = moment(value, "DD/MM/YYYY"); | |
return end.diff(start) >= 0; | |
}, "End date must be greater than start one."); | |
$.validator.addMethod("isValidDate_pt_BR", function(value, element) { | |
return moment(value, "DD/MM/YYYY").isValid(); | |
}, "Invalid date"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment