Reputation: 2441
i need to check if the user has inputted the correct from - to values for date on my form
for example: (dd/mm/yyyy)
WRONG:
From: 20/12/2012 - To: 11/12/2012
CORRECT:
From: 20/12/2012 - To: 30/12/2012
i need to check the values from the "from" and "to" input fields, so that i can pass the the value to my ajax script, is there anyway to achieve this result using javascript?
Upvotes: 0
Views: 79
Reputation: 15105
IF the dates are properly formatted
var BegDT = new Date(st1);
var EndDT = new Date(st2);
You can now subtract BegDT from EndDt and give an error if you don't get a positive number
Upvotes: 1