Here's the code we use for setting up and comparing dates in JavaScript. On my site, my visitors select the month from a drop down list, the day from a drop down list, the year from a drop down list, the hours from a drop down list, minutes from drop down list and the am /pm from a third drop down list. There are two sets of these on this page, (start date/time and end date/time). This script compares the two and prevents the end date from being earlier than the start date. It's probably not exactly what you're looking for, but I'm sure you can learn something from it.
var syearvar = parseFloat(form_obj.syear.options[form_obj.syear.selectedIndex].value)
var smonthvar = parseFloat(form_obj.smonth.options[form_obj.smonth.selectedIndex].value)
var sdayvar = parseFloat(form_obj.sday.options[form_obj.sday.selectedIndex].value)
var shourvar = parseFloat(form_obj.shour.options[form_obj.shour.selectedIndex].value)
var sminvar = parseFloat(form_obj.smin.options[form_obj.smin.selectedIndex].value)
if (form_obj.sampm.options[form_obj.sampm.selectedIndex].value == "pm"

{
if (shourvar < 12) {
shourvar = shourvar + 12
}
} else {
if (shourvar == 12) {
shourvar = 0
}
}
var eyearvar = parseFloat(form_obj.eyear.options[form_obj.eyear.selectedIndex].value)
var emonthvar = parseFloat(form_obj.emonth.options[form_obj.emonth.selectedIndex].value)
var edayvar = parseFloat(form_obj.eday.options[form_obj.eday.selectedIndex].value)
var ehourvar = parseFloat(form_obj.ehour.options[form_obj.ehour.selectedIndex].value)
var eminvar = parseFloat(form_obj.emin.options[form_obj.emin.selectedIndex].value)
if (form_obj.eampm.options[form_obj.eampm.selectedIndex].value == "pm"

{
if (ehourvar < 12) {
ehourvar = ehourvar + 12
}
} else {
if (ehourvar == 12) {
ehourvar = 0
}
}
var begdate = new Date(syearvar,smonthvar-1,sdayvar,shourvar,sminvar,00)
var enddate = new Date(eyearvar,emonthvar-1,edayvar,ehourvar,eminvar,00)
if (enddate < begdate) {
window.alert("The Delivery End Date / Time is less than the Beginning End Date / Time. Please correct before continuing."

form_obj.emonth.focus()
return false
}
This covers the date object and the comparison.
TW