comparing two dates in a form
i want to be able to compare two dates. The user enters one date in and then, in the same form, after the first date, they enter a second date. I want the fields to compare each other and if they aren't a tleast two weeks apart pop up with an alert.
I know how to do the alert but dont know how to compare to dates in an if statement.
How do i compare two dates in an if statement? is that how i would do it?
I assume that both fields need to make the comparison but how do you deal with the first field when the second field does not have a value yet. I think both fields need to make the comparison otherwise one could go back and change the first field and get away with two dates that are too close.