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解决方案后,现在好了,我终于得到了我想要的!! –