/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(function(scope){ scope = scope || window; var bissexto = function(year){ return year%4==0 && year%100!=0 || year%400==0; }; var dayByMonth = [null,31,28,31,30,31,30,31,31,30,31,30,31]; scope.validDate = function(year, month, day){ return bissexto(year) && month==2 ? day<=29 : day <= dayByMonth[month]; } })(window);
Comments
