OshoParth
OshoParth

Reputation: 1552

Change the Current date for Arshaw Full-Calender ?

I am using arshaw fullcalendar api for rendering calendar. My application has client server architecture ie I have the database for my application on a server which is available on the client machiene as and when requested. All i want is that the server date should be reflected on client side when Today option is selected. For that i have done the following : (only a section of code)

var calendar = $('#calendar').fullCalendar({

            year: runningYear, // assume 2010
            month: runningMonthNew, // assume 10
            date: runningDate, // assume 15

            columnFormat: { 
                week: 'ddd dd/MM', // Mon 9/7
                day: 'dd/MM' // Mon 9/7
            }

Where runningYear,runningMonthNew and runningDate are already defined. The date values displayed are as passed except for the today option on clicking on today the calender takes the client machine date not the server date passed. Please suggest a way by which i can change the date settings for the today option from client current date to the Server date.

Upvotes: 0

Views: 122

Answers (1)

user2256291
user2256291

Reputation:

make these changes in fullcalendar.js

assuming year is server year, month is server month , day is server date

replace today function with these lines.

function today() {
        var actServerDate = new Date(year,month,day);
        var today = actServerDate;
        date = actServerDate;
        renderView();
    }

in renderView() function replace

var today = new Date(); 

with

 var actServerDate = new Date(year,month,day);
 var today = actServerDate;
 date = actServerDate;

Upvotes: 4

Related Questions