jquery - MVC Javascript DateTime -
i have been developing new website , have come across strange datetime problem cannot seem work out wrong.
my staging server here: link
as can see, people can enquire taxis "now" or in "future".
what should happen if chose "future" , put in date/time more 2 hours ahead able give live quotes taxis. if lead time less 2 hours ahead should not see "live" quotes.
i developing based on api company in finland , have been testing well.
the guys in finland reporting when select "now" still getting live quotes when shouldn't.
i use javascript populate datetime selectors on page this:
var d = new date(); var curr_hour = d.gethours(); // in 24 hour var curr_minute = d.getminutes(); var curr_date = d.getdate(); var curr_month = d.getmonth() + 1; //months 0 based var curr_year = d.getfullyear(); if (curr_minute < 15) { $("#enquiry_timemins").val(15); } if (curr_minute >= 15 && curr_minute < 30) { $("#enquiry_timemins").val(30); } if (curr_minute >= 30 && curr_minute < 45) { $("#enquiry_timemins").val(45); } if (curr_minute >= 45 && curr_minute < 59) { $("#enquiry_timemins").val(00); curr_hour = curr_hour + 1; } if (curr_hour >= 12) { $("#enquiry_timeampm").val("pm"); $("#enquiry_timehours").val(curr_hour - 12); } else { $("#enquiry_timeampm").val("am"); $("#enquiry_timehours").val(curr_hour); } $("#enquiry_pickuptime").val(curr_date + "/" + curr_month + "/" + curr_year);
and in controller this:
theroute.enquiry.pickuptime = theroute.enquiry.pickuptime.addhours(theroute.enquiry.timehours); theroute.enquiry.pickuptime = theroute.enquiry.pickuptime.addminutes(theroute.enquiry.timemins); if (theroute.enquiry.timeampm == "pm") { theroute.enquiry.pickuptime = theroute.enquiry.pickuptime.addhours(12); }
this seems work me i'm based in uk. guys in finland happen 2 hours ahead well. seems more coincidence lead time 2 hours ahead.
can see haven't considered makes work in uk not in finland, , possibly other countries well?
guess theroute.enquiry.pickuptime created in time zone.
Comments
Post a Comment