I have the following function run onsubmit for a form:
basically it checks that everything is filled and that the epoch time of ending date for the event is greater than the starting date. This works fine in chrome, but why does it not work in safari? Could some one lend me a hand?
Code:
function validate(form)
{
for(i = 0; i < form.elements.length; i++)
{
if(form.elements[i].value == "") {
alert('Please fill everything!');
return false;
}
}
if(form.AP1.value=='PM' && form.hour.value !='00' && form.hour.value !='12'){
b_time=form.hour.value*1;
b_time=b_time+12;
}else{
b_time=form.hour.value;
}
if(form.AP2.value=='PM' && form.hour2.value !='00' && form.hour2.value !='12'){
b2_time=form.hour2.value*1;
b2_time=b2_time+12;
}else{
b2_time=form.hour2.value;
}
begin=form.date.value+" "+b_time+":"+form.min.value+":00";
end=form.date_end.value+" "+b2_time+":"+form.min2.value+":00";
var myDate = new Date(begin); // Your timezone!
var myEpoch = myDate.getTime()/1000.0;
var myDate1 = new Date(end); // Your timezone!
var myEpoch1 = myDate1.getTime()/1000.0;
if(myEpoch1>=myEpoch){
}else{
alert('Please make sure your end time is after start time! Midnite is the first hour of each day!');
return false;
}
return true;
}
basically it checks that everything is filled and that the epoch time of ending date for the event is greater than the starting date. This works fine in chrome, but why does it not work in safari? Could some one lend me a hand?