5

I'm using Fullcalendar within a Asp.Net project and I'm using the function 'events' to refresh items in my calendar.

I'm putting events in myArray to pass it in the callback function as below:

var event = {
                title: 'Disponível',
                start: moment(horario.DtInicio),
                end: moment(horario.DtFim),
            }
myArray.push(event);

where horario.DtInicio and horario.DtFim is a Asp.Net json Date (eg. "/Date(1423321200000)/")

When I show callendar in month view, this date shows in 02/06/2015 (mm/dd/yyyy), but when I toggle to other view, this event shows in 02/07/2015. The real date is 02/07/2015.

Has anyone faced this situation?

Gabriel
  • 83
  • 2
  • 9

2 Answers2

8

Try to set the timezone for the calendar:

$('#calendar').fullcalendar({
    timezone : 'local',
    ...
});
RodrigoDela
  • 1,706
  • 12
  • 26
  • I am also experiencing the issue that the OP is facing. Setting the timezone to "local" did not help. I am running FullCalendar 2.2.6, jQuery 2.1.3, jQuery UI 1.10.4 and moment.js 2.8.3. – jkndrkn Feb 11 '15 at 15:05
  • Unfortunately, still wrong yet. The constructor of calendar is like that: $('#calendar').fullCalendar({ header: { left: 'prev,next', center: 'title', right: 'month,agendaWeek,agendaDay' }, theme: true, lang: 'pt-br', //timezone: 'America/Sao_Paulo', timezone: 'local', defaultView: 'agendaWeek', allDaySlot: false, events: $scope.eventsCallBack }); – Gabriel Feb 18 '15 at 23:27
  • It works fine for me here: http://jsfiddle.net/ed05a85w/1/ I am using your config @GabrielAyussoGuimarães Please make sure you are using the latest fullcalendar release. – RodrigoDela Feb 20 '15 at 12:44
  • I am using FullCalendar v2.4.0 and in which file i need to add this property,not sure in fullcalendar.min.js or moment.js ? – Akash Sep 22 '16 at 07:39
  • This is the init of your calendar, so you need to add it in your code. – RodrigoDela Sep 22 '16 at 12:28
  • AWESOME! THANKS!! – Ozan Kurt Sep 24 '16 at 15:18
  • If you have problems with filters and have no idea why your event rendering not in day you want that is answer to it. – Matas Lesinskas May 13 '18 at 19:49
0

As RodrigoDela suggested, try setting your timezone. If that does not help, then try what worked for me.

Setting the timezone alone to "local" did not fix the issue for me. Updating moment.js from 2.8.3 to 2.8.4 did fix the issue.

For reference, I am running the following versions of FullCalendar and its dependencies:

  • FullCalendar 2.2.6
  • jQuery 2.1.3
  • jQuery UI 1.10.4
  • moment.js 2.8.4

Additional details regarding my debugging process and fix here.

jkndrkn
  • 4,012
  • 4
  • 36
  • 41