2012-08-17 75 views
0

我一直在使用FullCalendar並遇到了Firefox中的一些問題。我可以選擇開始日期以IETF格式。出於某種原因,IE8能夠發佈這個(並將其自動轉換爲時間戳),但Firefox不會。FullCalendar Firefox中的IETF日期

它使它成爲IETF格式,並且PHP的date()函數不起作用。我使用fullCalendar.formatDate()函數作爲解決方法,但這似乎不是對我來說最好的解決方案。

有沒有另一種方法來完成這項工作?

<script type='text/javascript'> 
    $(document).ready(function() { 
     var date = new Date(); 
     var calendar = $("#calendar").fullCalendar({ 
      theme: true, 
      title: "Employee Calendar", 

      header: { 
       left: 'prev,next today', 
       center: 'title', 
       right: 'month,agendaWeek,agendaDay' 
      }, 
      buttonIcons: {prev: 'circle-triangle-w', next: 'circle-triangle-e'}, 
      editable: true, 
      droppable: true, 
      events: '<?php echo matry::base_to('utilities/calendar_events');?>', 
      eventClick: function (event) { 
       $.ajax({ 
        url: '<?php echo matry::base_to('utilities/calendar_tools');?>', 
        type: 'POST', 
        data: {id: event.id, job: 'getEvent'}, 
        success: function(data){ 
         $("#event_box").fadeIn(500); 
         $("#event_info").html(data);   
        } 
       }); 
      }, 
      selectable: true, 
      selectHelper: true, 
      select: function (start, end, allDay){          
       var title = prompt('Event Title'); 
       start = $.fullCalendar.formatDate(start, 'yyyy-MM-dd HH:mm:ss'); 
       end = $.fullCalendar.formatDate(end, 'yyyy-MM-dd HH:mm:ss'); 
       if (title) 
       { 
        $.ajax({ 
         type: 'POST', 
         url: '<?php echo matry::base_to('utilities/calendar_tools');?>', 
         data: {title: title, start: start, end: end, allDay: allDay, job: 'createEvent'}, 
         success: function(data) { 
          calendar.fullCalendar('refetchEvents'); 
          $("#alerts").html(data); 
         }//close success function 
        })//close ajax 
       } 
       else 
        calendar.fullCalendar('unselect'); 
      }//close select function 
     }); //close fullcalendar function 

     $("#calendar_controls").accordion({ 
      collapsible: true, 
      clearStyle:true, 
      active: false, 
      autoHeight: true 
     });//close calendar controls 

     $(document).on('submit', '#event_form', function (event){ 
      event.preventDefault(); 
       $.ajax({ 
        url: '<?php echo matry::base_to('utilities/calendar_tools');?>', 
        type: 'POST', 
        data: $('#event_form').serialize(), 
        success: function(data){ 
         $("#event_box").fadeOut('2000'); 
         $("#alerts").html(data).focus(); 
        } 
       })  
     });//close on function 

     $(document).on('click', '#delete', function() { 
      var con = confirm('Do you want to delete this Event?'); 
      if (con) 
      { 
       var id = $("#event_form input[name= 'id']").val(); 
       $.ajax({ 
        url: '<?php echo matry::base_to('utilities/calendar_tools');?>', 
        data: {id: id, job: 'deleteEvent'}, 
        type: 'POST', 
        success: function(data){ 
         $("#alerts").html(data).focus() 
         calendar.fullCalendar('refetchEvents'); 
         $("#event_box").fadeOut(1000); 
        ;} 
       }); 
      } 
     }) 
    }); //close document.ready function 
</script> 

回答

0

IETF日期格式沒有得到通過Firefox的正確傳遞,但日期可以顯示運行良好的$ .fullCalendar.formatDate()函數所改變。如果在日期通過的地方添加了這些內容,則格式可以更改。