Created
September 17, 2010 15:25
-
-
Save yayadrian/584387 to your computer and use it in GitHub Desktop.
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
$("#date").blur(function() { | |
var value= $(this).val(); | |
var userDate = new Date(value); | |
var dateString = Date(); | |
var currDate = new Date(dateString); | |
var minDate = new Date(dateString); | |
var maxDate = new Date(dateString); | |
//var minDate = currDate; | |
minDate.setFullYear(currDate.getFullYear() - 5); | |
// var maxDate = currDate; | |
maxDate.setFullYear(currDate.getFullYear() - 100); | |
if(userDate > minDate || userDate < maxDate) { | |
alert(currDate.getFullYear() + " bad date is max: " + maxDate.getFullYear() + " or the min" + minDate.getFullYear()); | |
} else { | |
alert("its ok"); | |
} | |
}); | |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment