Reputation: 1702
I have a NodeJS application that uses Fullcalendar on the client side.
This very same app, when run on my dev environment renders the calendar with the correct dates and times.
When I run it on the production box, the dates and times are being rendered wrong. It's just like it's ignoring the timezone information. What's weird is that the client is still me and that the production server is sending as output the same JSON that you can see there:
[{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-18T22:00:00.000Z","end":"2014-06-19T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-19T22:00:00.000Z","end":"2014-06-20T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-20T22:00:00.000Z","end":"2014-06-21T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-21T22:00:00.000Z","end":"2014-06-22T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-22T22:00:00.000Z","end":"2014-06-23T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-23T22:00:00.000Z","end":"2014-06-24T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-24T22:00:00.000Z","end":"2014-06-25T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-25T22:00:00.000Z","end":"2014-06-26T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-26T22:00:00.000Z","end":"2014-06-27T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-27T22:00:00.000Z","end":"2014-06-28T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-28T22:00:00.000Z","end":"2014-06-29T18:00:27.000Z","allDay":false},{"id":"53a2d4f2eec975b1095ef5c7","title":"prova","start":"2014-06-29T22:00:00.000Z","end":"2014-06-30T18:00:27.000Z","allDay":false},{"id":"53a2fe7beec975b1095ef5c9","title":"aaa","start":"2014-06-18T06:00:00.000Z","end":"2014-06-18T11:00:00.000Z","allDay":false}]
The calendar is being initialized this way:
$(document).ready(function() {
$('#calendar').fullCalendar({
events: '/scheduler/events',
firstDay: 1,
timeFormat: 'HH:mm',
header: {
left: 'title',
center: '',
right: 'today, prev, next, month, agendaWeek'
},
timezone: "local",
dayClick: function(date, jsEvent, view) {
},
eventClick: function(event, jsEvent, view) {
});
}
});
As an example, I'm in the CEST timezone and the very first record of the JSON should display as start 2014-06-19 00:00:00 and end 2014-06-19 20:00:27 but it displays 2014-06-18 22:00:00 and 2014-06-19 18:00:27
I tried setting the timezone option of Fullcalendar to "local", false, "UTC", "CEST" but with no luck.
Any idea of what might be wrong? Thanks!
Upvotes: 2
Views: 3228
Reputation: 1702
Thanks to the author of Fullcalendar who pointed me in the right direction. The answer is that Node JS doesn't get the correct timezone from the OS for some unknown reason. It does get it on my development box (OSX) but on the production one (Linux) it doesn't.
I simply added this to my start script and now it works like a charm:
export TZ="Europe/Rome"
Upvotes: 1