2010-10-19 103 views

回答

3
$('calendar').fullCalendar('getView').start 
$('calendar').fullCalendar('getView').end 
42

如果你正在尋找的可見開始和結束日期,這將是視圖對象的visStartvisEnd財產版本1

$('calender').fullCalendar('getView').visStart 

$('calender').fullCalendar('getView').visEnd 

這將intervalStartintervalEnd in version 2

$('calender').fullCalendar('getView').intervalStart 

$('calender').fullCalendar('getView').intervalEnd 

如果您正在尋找當前周/月的開始和結束日期,這將是當前視圖對象的startend屬性:

$('calendar').fullCalendar('getView').start 

$('calendar').fullCalendar('getView').end 

參考:Full Calendar documentation.

+1

在最新版本(V2)中,屬性是'intervalStart'和'intervalEnd'而不是'visStart'和'visEnd'(文檔:http://arshaw.com/fullcalendar/docs/views/View_Object/) :-) – 2014-07-16 03:50:09

+2

這個答案很好,但措辭讓我感到困惑。 'intervalStart'和'intervalEnd'是日曆_wants_表示的時間間隔的開始和結束,所以例如它們將是當前月份的第一天和最後一天,即使顯示了前一個/下一個月的天數。 'start'和'end'給出所顯示的實際時間的開始和結束,包括月份以外的日子。 – 2015-07-02 07:33:14

1

你需要給你的id/class你指定的jquery完整日曆

var start_date = $('#schedule-events').fullCalendar('getView').start 
    var end_date = $('#schedule-events').fullCalendar('getView').end 

上面#schedule-events of the full calendar ..你應給予充分的日曆

實例的ID:

$('#schedule-events').fullCalendar({ 

      eventRender: function(event, element) { 

      var start_date = $('#schedule-events').fullCalendar('getView').start 
      var end_date = $('#schedule-events').fullCalendar('getView').end 
      console.log(start_date +'sart----------end date'+end_date) 

        } 

......................等...... ....

2

我不知道爲什麼,我看到這種不同的行爲,但多虧了別人,我在正確的方向,但得到的「開始」和「結束」的時刻()的對象。因此,要獲得實際的日期,你需要使用:

$('calendar').fullCalendar("getView").start.format() 
$('calendar').fullCalendar("getView").end.format() 

作品完全一樣,我需要什麼的任擇議定書要求。注意:結束日期是日曆之後的一天。也就是說,我正在查看的日曆從2016年7月31日星期日開始,於2016年10月9日星期六結束 - 我給出的日期是2016-07-31和2016-09-11(日期後的一天在技​​術上顯示 - 當然如果你說那些日子的「00:00:00」你會準確的)。

相關問題