My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1977: time zoning issue - between server side and client side.
1 person starred this issue and may be notified of changes. Back to list
Status:  Duplicate
Merged:  issue 738
Owner:  ----
Closed:  Aug 2013


Sign in to add a comment
 
Reported by kneid...@gmail.com, Aug 24, 2013
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



Aug 25, 2013
Project Member #1 adamrs...@gmail.com
merging into a related discussion...
Status: Duplicate
Mergedinto: 738
Sign in to add a comment

Powered by Google Project Hosting