2016-08-02 62 views
2

我正在使用fullcalendar和angularJs進行事件調度器應用程序。 在這裏,我得到所有的輸出,除了開始時間和結束時間周議程。 我如何獲得日曆中的開始和結束時間。如何在angularJs中獲取fullCalendar中的開始時間和結束時間

var myApp = angular.module('calenderApp', ['ui']); 
myApp.controller('calenderCtrl', ['$scope', '$http' ,function($scope, $http) 
{ 
getInfo(); 
function getInfo() 
{ 
    var date = new Date(); 
    var d = date.getDate(); 
    var m = date.getMonth(); 
    var y = date.getFullYear(); 
$scope.uiConfig = { 
     calendar:{ 
     defaultView: 'agendaDay', 
     height: 450, 
     firstDay: 1, 
     weekends:false, 
     editable: true, 
     header:{ 
      left: 'title', 
      center: 'month', 
      right: 'today prev,next' 
     }, 
     ignoreTimezone: false, 
     dayClick: $scope.alertEventOnClick, 
     eventDrop: $scope.alertOnDrop, 
     eventResize: $scope.alertOnResize 
     } 
    }; 
    $http.post("http://localhost/AdminLTE-master/sism_crm/route/campaign/campaign/calendar").then(function(response) { 
    $scope.events = response.data; 
    var length=response.data.length; 
    for(var i=0;i<length;i++) 
    { 
     $scope.eventSources.push({ 
      idx: response.data[i].idx, 
      title: response.data[i].title, 
      description : response.data[i].description, 
      allDay: true, 
      start: new Date(response.data[i].start), 
      end: new Date(response.data[i].end), 
      startTime: new Date(response.data[i].startTime), 
      endTime: new Date(response.data[i].endTime), 
      }); 
      calendar.fullCalendar('refetchEvents'); 
     } 
    }); 
} 
}]); 

如何在calendar.thanks提前獲得開始時間和結束時間.. !!

回答

0

使用moment.js用下面的代碼:

moment(event.start).format('h:mm:ss'); 

這對我的作品,因爲我想在點擊事件對象的時間。

相關問題