Skip to content

Instantly share code, notes, and snippets.

@hikahi
Created January 20, 2009 17:12
Show Gist options
  • Save hikahi/49560 to your computer and use it in GitHub Desktop.
Save hikahi/49560 to your computer and use it in GitHub Desktop.
function dateParser (date) {
str1 = date;
dt1 = parseInt(str1.substring(0,2),10);
mon1 = parseInt(str1.substring(3,5),10);
yr1 = parseInt(str1.substring(6,10),10);
depart1 = new Date(yr1, mon1, dt1);
parsedDate = new Date(date);
return parsedDate;
}
function travelDates () {
for (i=0; i < document.getElementsByName("date").length; i++) {
travelDates = new Array();
travelDates[i] = [dateParser(document.getElementsByName("date")[i].value)];
}
for (i=0; i < travelDates.length -1; i++) {
if (travelDates[i] > travelDates[i+1]) {
alert ("good");
} else {
alert ("bad");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment