0
我有兩個日期,例如1/04/2017 - 2017年3月30日Javascript:查找兩個日期之間每個月的第一個和最後一個日期?
我想查找上述日期範圍之間每個月的第一個和最後一個日期。
這樣的 -
2017年1月4日 - 30/04/2017 2017年1月5日 - 31/05/2017 2017年1月6日 - 30/06/2017
這是因爲我想用在fullcalendar該解決方案,週期性活動,這樣我就可以在下面的代碼添加日期範圍 -
batches.push({
id : item.id,
title : item.title.textCapitalize(),
start : item.start_time,
end : item.end_time,
dow : item.weekdays,
ranges :
[
{
start : '2017-04-01', //all of april
end : '2017-04-20',
},
{
start : '2017-05-01', //all of may
end : '2017-05-31',
},
{
start : '2017-06-01', //all of june
end : '2017-06-30',
},
],
backgroundColor : backgroundColor,
borderColor : backgroundColor
});
你爲什麼不使用[fullcalendar復發事件(http://stackoverflow.com/q/15161654/35070)? – phihag
謝謝你的建議,但我只有在我的數據庫表中開始和結束日期。 –
結合#phihag建議和#mplungjan解決方案後,現在好了,我終於得到了我想要的!! –