Carlos Uriel Santiago Carlos Uriel Santiago - 1 year ago 111
jQuery Question

FullCalendar dates and times rendered incorrect rails

FullCalendar implement in my RoR application, and today he is doing tests I realized that the dates and the days are incorrect.
I worked well until this day, create a new application and the same thing happens, today is Monday, 4 November,
and I get that it is not November 6

var initialize_calendar;
initialize_calendar = function() {
var calendar = $(this);
header: {
left: 'prev,next today',
center: 'title',
today: 'hoy',
month: 'month',
week: 'week',
day: 'day',
right: 'month,agendaWeek,agendaDay'

allDayText: "Todo el dia",

buttonText: {
today: "Hoy",
month: "Mes",
week: "Semana",
day: "Hoy"

monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'],
dayNames: ['Lunes', 'Martes', 'Miercoles', 'Jueves','Viernes', 'Sabado', 'Domingo'],
dayNamesShort: ['Lun', 'Mar', 'Mier', 'Jue', 'Vie', 'Sab', 'Dom'],
defaultView: 'agendaDay',
selectable: true,
minTime: '08:00:00',
maxTime: '20:00:00',
slotDuration: '00:60:00',
hiddenDays: [ 5, 6 ],
selectHelper: true,
editable: true,
eventLimit: true,
events: '/events.json',
timezone: "local",

select: function(start, end) {
$.getScript('/events/new', function() {
$('#event_date_range').val(moment(start).format("MM/DD/YYYY HH:mm") + ' - ' + moment(end).format("MM/DD/YYYY HH:mm"))
$('.start_hidden').val(moment(start).format('YYYY-MM-DD HH:mm'));
$('.end_hidden').val(moment(end).format('YYYY-MM-DD HH:mm'));


eventDrop: function(event, delta, revertFunc) {
event_data = {
event: {
start: event.start.format(),
end: event.end.format()
url: event.update_url,
data: event_data,
type: 'PATCH'

eventClick: function(event, jsEvent, view) {
$.getScript(event.edit_url, function() {
$('#event_date_range').val(moment(event.start).format("MM/DD/YYYY HH:mm") + ' - ' + moment(event.end).format("MM/DD/YYYY HH:mm"))
$('.start_hidden').val(moment(event.start).format('YYYY-MM-DD HH:mm'));
$('.end_hidden').val(moment(event.end).format('YYYY-MM-DD HH:mm'));
$(document).on('turbolinks:load', initialize_calendar);

Answer Source

My inability to read Spanish meant I couldn't see the error ;)

You need to start your dayNames & dayNamesShort arrays with Domingo. FullCalendar docs.

dayNames: ['Domingo', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado'],
dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mier', 'Jue', 'Vie', 'Sab']
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download