How can get start and end time on fullcalendar?

后端 未结 7 1310
日久生厌
日久生厌 2021-02-12 12:17

how can i get start and end time of visible days in fullcalendar?

I need it for use in another javascript instace. Is there some function like -

7条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-12 12:39

    I don't know why I'm seeing such different behavior but thanks to the others, I got in the right direction but the "start" and "end" are moment() objects. Thus to get the actual date, you need to use:

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

    Works exactly like I need and what the OP asked. NOTE: The end date is one day after the calendar. That is, the calendar I'm looking at starts on Sunday 7/31/16 ends on Saturday 9/10/16 - and the date given me are 2016-07-31 and 2016-09-11 (one day after the date shown technically - of course if you say "00:00:00" of those days you'll be accurate).

提交回复
热议问题