jquery validator Date
$.validator.addMethod("birth", function (value, element) {
var ActualDate = new Date();
var ActualYear = ActualDate.getFullYear();
var ActualMonth = ActualDate.getMonth();
var ActualDay = ActualDate.getUTCDate();
ActualMonth += 1; // O actual month vem sempre com menos um valor do verdadeiro mês
var Data_Inserida = value.split("-");
var year = parseInt(Data_Inserida[0], 10),
month = parseInt(Data_Inserida[1], 10),
day = parseInt(Data_Inserida[2], 10);
if (year == ActualYear) {
if (month == ActualMonth) {
if (day > ActualDay) {
return false;
} else
return true
} else {
if (month > ActualMonth)
return false;
else
return true;
}
}
// Máximo de idade neste caso é a idade de reforma, minímo de idade 18
if (year > (ActualYear - 66) && year < ActualYear-18) {
return true;
} else
return false;
return false;
})
Also in JavaScript:
- redblobgames pathfinding
- webpack Module not found: Error: Can't resolve '../
- node js interview questions
- Rectangle class module
- react native search bar
- readonly attribute in html by javascript
- remove header border react native
- js if array is 2d
- How to copy text from a div to clipboard
- how to send authorization in header of HTTP GET using ajax
- array concat in javascript
- jquery first child
- sublime text json formatter
- find object in array javascript with property
- json_decode jquery
- javascript to remove duplicates from an array
- format date javascript
- javascript convert to and from binary
- loopback float type
- setinterval vs settimeout in javascript\
- javascript dom methods list
- como percorrer um objeto js
- check if click is inside div javascript
- url validator javascript