Skip to content

Instantly share code, notes, and snippets.

@codecowboy
Created July 31, 2011 17:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecowboy/1116979 to your computer and use it in GitHub Desktop.
Save codecowboy/1116979 to your computer and use it in GitHub Desktop.
$('.fc-day-number').each(function(){
lDay = parseInt($(this).text());
//check if it is another month date
if($(this).parents('td').hasClass('fc-other-month'))
{
lYear = parseInt(cYear);
//if it is belong to the previous month
if(lDay>15)
{
lMonth = parseInt(cMonth) - 1;
lDate = new Date(lYear,lMonth,lDay,12,00,00,00);
dateArr.push(lDate);
}
else //belong to the next month
{
lMonth = parseInt(cMonth) + 1;
lDate = new Date(lYear,lMonth,lDay,12,00,00,00);
dateArr.push(lDate);
}
}
else
{
lMonth = parseInt(cMonth);
lDate = new Date(lYear,lMonth,lDay,12,00,00,00);
dateArr.push(lDate);
}
});
@thejimgaudet
Copy link

I believe the reason for this is because the calendar object stores a max of the first two weeks for the next month (which can be a max of 14 days on a Feb that starts on Sun) on the Actual display page. This changes each time the viewDisplay is called (http://arshaw.com/fullcalendar/docs/display/viewDisplay/)

Since you may see up to day 14 for the next month, anything 15 and over (I guess the code should reflect that!) must be for the previous month

Hope that helps,

@codecowboy
Copy link
Author

codecowboy commented Aug 1, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment