i am using fullCalendar in a web app of mine - in agendaWeek mode, to show a weekly class schedule, that repeats the same each and every week.
the events are coming in from a database.
i have found that i have a conflict in dates between server side and client side day/times. the server is sitting in the US somewhere and i (and the users) are in at GMT+3 - so there is 8 -10 hours difference.
my first issue was that using start as start: new Date(y, m, d, 14, 30), - instead of displaying it on Sunday - would display it on TODAY - whenever you happen to be looking at the calendar.
i managed to come up with an algorithm to bridge the gap, so that the events are displayed on Sunday through Thursday.
this is the solution, in Classic ASP inline with the JS:
<% 'ASP CODE:
todaysDayNumber = weekday(now())
%>
//in JS:
var n = date.getDay()+1; //number of day in the week. add 1 so we can compare to ASP
if (n!=<%=todaysDayNumber%>){
//alert("days not equal");
var timeZoning = 1;
} else {
//alert("days ARE equal");
var timeZoning = 0;
}
<% 'back to ASP:
i = 4 '//where i is the week day i want the event to appear on (from 1 to 7)
todaysDayNumber = weekday(now()) '// from 1 to 7
'ASP calculation:
dayCalc = (-1*todaysDayNumber)+i
if dayCalc < 0 then
sign = "-"
dayCalc = abs(dayCalc)
else
sign = "+"
end if
%>
{
title: 'Event Name',
id: 11430,
start: new Date(y, m, d<%=sign & dayCalc%>-timeZoning, 14, 30),
end: new Date(y, m, d<%=sign & dayCalc%>-timeZoning, 17, 00),
allDay: false
},
This above solution works nicely, but its on the server side. which leads me to the next problem... I still have a hole in the system where on a saturday night in the US, where its already sunday morning by me - nothing at all displays, and only later in the day (8-10 in the morning), everything comes back to the calendar
i saw a couple of answers relating to ignoreTimezone which didnt seem to have any effect and also something relating to minute/second conversion but i wasnt sure how to implement that.
any help appreciated!
thanks
Mergedinto: 738