Menu
Hi I’ve been working on what should be a simple script I want to take a date and compare it with the current date and if it is in the past it is invalid.
Here’s my code right now the date is hard coded but I would like to change it to be a variable. Does anyone see anything wrong with my code sometimes I think it’s working and then it isn’t.
<script>
today = new Date();
enteredDate = new Date(“23/12/2004”);
if (today < enteredDate){
alert(“this date has past”);
}
else{
alert(“this is a good date”);
}
</script>
TIA
Nikki