FullCalendar在月视图中显示事件,但在日、周或资源视图中不显示



我正在使用fullcalendar Sean Kenny的fork添加资源视图。

源网页

问题是有些事件只是显示在月份视图下,而不是周视图或资源视图中。

allDay对于所有事件设置为false

$(document).ready(function() {
  var date = new Date();
  var d = date.getDate();
  var m = date.getMonth();
  var y = date.getFullYear();
  $('#calendar').fullCalendar({
    header: {
      left: 'prev,next today',
      center: 'title',
      right: 'month,agendaWeek,resourceDay'
    },
	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: [ 'Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
	dayNamesShort: ['Dom','Lun','Mar','Mie','Jue','Vie','Sab'],
	buttonText: {
		today: 'hoy',
		month: 'mes',
		week: 'semana',
		day: 'dia'
	},
	allDaySlot : false,
	slotDuration: '00:15:00',
	axisFormat: 'HH:mm',
	firstDay : 1,
	minTime: '09:00:00',
	maxTime: '20:00:00',
    defaultView: 'resourceDay',
	allDayDefault: false,
    editable: true,
    droppable: true,
	disableResizing: false,
    resources: [{
		'id': '1',
		'name': 'Sara'
    }, {
		'id': '2',
		'name': 'Angela'
    }],
    selectable: true,
    selectHelper: true,
	events: 'load_events.php',
    select: function(start, end, ev) {
		console.log(ev.resources);
		var horaIni = moment(start).format("YYYY-MM-DD HH:mm:ss");
		var horaFin = moment(end).format("YYYY-MM-DD HH:mm:ss");
		if(isHoraMaxOver(end)){
			alert(mensajeHoraMax);
		}else if(isEventOverlapped(ev,horaIni,horaFin)){
			alert(mensajeOverlap);
		}else if(isDomingo(horaIni)){
			alert("Los Domingos descansamos. Lo siento");
		}else{
			createEvent(horaIni,horaFin,ev);
		}
    },
    eventClick: function(calEvent, jsEvent, view){
		if(isAdmin()){
			modifyEvent(calEvent);
		}
    },
    eventDrop: function (event, delta, revertFunc) {
		var start = moment(event.start).format("YYYY-MM-DD HH:mm:ss");
		var end = moment(event.end).format("YYYY-MM-DD HH:mm:ss");
		if(isHoraMaxOver(end)){
			alert(mensajeHoraMax);
		}else if(isEventOverlapped(event,start,end)){
			alert(mensajeOverlap);
		}else if(isDomingo(start)){
			alert("Los Domingos descansamos. Lo siento");
		}else{
			$.ajax({
				url:  'update_event.php',
				data: 'fechaIni='+ start +'&fechaFin='+ end +'&id='+ event.id +'&profesional='+ event.resources,
				type: "POST"
			});
		}
		$('#calendar').fullCalendar('refresh');
		location.reload(true);
	},
	loading: function(bool){
		if(!bool){
			diableforInvitados();
			updateResources();
		}
	},
	eventRender: function(event, element) { 
            element.find('.fc-event-title').append("<br/>" + event.description);
	},
	eventResize: function(event, delta, revertFunc) {
		var start = moment(event.start).format("YYYY-MM-DD HH:mm:ss");
		var end = moment(event.end).format("YYYY-MM-DD HH:mm:ss");
		if(isHoraMaxOver(end)){
			alert(mensajeHoraMax);
		}else if(isEventOverlapped(event,start,end)){
			alert(mensajeOverlap);
		}else{
			$.ajax({
				url:  'update_event.php',
				data: 'fechaIni='+ start +'&fechaFin='+ end +'&id='+ event.id,
				type: "POST"
			});
		}
		$('#calendar').fullCalendar('refresh');
		 location.reload(true);
	}
  });
  
	$("#calendar").fullCalendar('rerenderEvents');
});

以下是事件的JSON提要示例

Object {id: "63", title: "mariana _", start: FCMoment, end: FCMoment, description: "manicura express esmalte normal   12mins   30.00 € <br/>"…}_allDay: false_end: FCMoment_d: Tue Nov 11 2014 21:12:00 GMT-0500 (Eastern Standard Time)_f: "YYYY-MM-DDTHH:mm:ssZ"_i: "2014-11-12T02:12:00-0500"_isAMomentObject: true_isUTC: true_locale: f_offset: 300_pf: Object_tzm: 300__proto__: f_id: "63"_start: FCMoment_d: Tue Nov 11 2014 21:00:00 GMT-0500 (Eastern Standard Time)_f: "YYYY-MM-DDTHH:mm:ssZ"_i: "2014-11-12T02:00:00-0500"_isAMomentObject: true_isUTC: true_locale: f_offset: 300_pf: Object_tzm: 300__proto__: fallDay: falseclassName: Array[0]color: "#00FF1E"description: "manicura express esmalte normal   12mins   30.00 € <br/>"end: FCMomentid: "63"resources: "1"source: Objectstart: FCMomenttitle: "mariana _"__proto__: Object

以下是当前网页的链接:网页

我找到了解决方案。问题是,这些活动是以24小时的格式预订的,而我却以12小时的格式拍摄。因此,那些在中午之后预订的活动没有在Day视图的时间范围内显示。时间范围:9:00-20:00。例如:开始时间:17:00->5:00PM被转换为凌晨5点,因此没有显示。

我不得不添加

timeFormat: 'H:mm'

并更改create_event.php

$fecha_inicio=date("Y-m-d H:i:s",strtotime($fecha_inicio));
$fecha_fin=date("Y-m-d H:i:s",strtotime($fecha_fin));

相关内容

  • 没有找到相关文章

最新更新