CC-2379: "Add Show" uses browser time instead of server time

-Fixed
This commit is contained in:
martin 2011-08-18 15:44:16 -04:00
parent 58c1eff283
commit dd9ef5b9c8
4 changed files with 51 additions and 18 deletions

View file

@ -61,10 +61,23 @@ function makeTimeStamp(date){
return timestamp;
}
function adjustDateToServerDate(date, serverTimezoneOffset){
//date object stores time in the browser's localtime. We need to artificially shift
//it to
var timezoneOffset = date.getTimezoneOffset()*60*1000;
date.setTime(date.getTime() + timezoneOffset + serverTimezoneOffset*1000);
/* date object has been shifted to artificial UTC time. Now let's
* shift it to the server's timezone */
return date;
}
function dayClick(date, allDay, jsEvent, view) {
var now, today, selected, chosenDate, chosenTime;
now = new Date();
now = adjustDateToServerDate(new Date(), serverTimezoneOffset);
if(view.name === "month") {
today = new Date(now.getFullYear(), now.getMonth(), now.getDate());