我正在使用完整日历
this.calendarOptions = {
height: '1000',
fixedWeekCount: false,
header:
{
left: 'prev,next,today',
center: 'title',
right: 'month,listYear',
},
defaultDate: new Date(),
editable: true,
timeFormat: 'hh:mm A',
eventLimit: true,
events: (start, end, title, callback) => {
this.calenderservice.getExamCandidateById(this.value)
.subscribe(response => {
callback(response),
this.modalData = response.Items
this.myCalendar.fullCalendar('renderEvents', this.modalData)
console.log(this.modalData);
console.log(response);
});
},
响应
Items:{
ExamName:null
ExamSiteId:334
Id:85
LastUpdateDateTime:"0001-01-01T00:00:00"
PostalCode:"33172"
PptSeats:null
SeatCount:0
SiteName:"UF"
State:"FL"
end:"2017-09-27T10:30:00"
isCbt:"1"
isPpt:null
start:"2017-09-27T10:30:00"
title:"7 available"
}
从上面的代码我获得了响应的所有开始和结束日期,并在日历中显示事件
我想隐藏过去的事件,如何隐藏包含过去开始和结束的事件,从当前日期开始。
请帮助我。
您应该在将值传递给完整日历之前应用过滤器。这样的东西:
events: (start, end, title, callback) => {
this.calenderservice.getExamCandidateById(this.value)
.subscribe(response => {
callback(response),
var date = new Date(); //Today's date
this.modalData = response.Items.filter( item => item.StartDate > date || item.EndDate > date ); //only select items whose start or end date are after today's date.
this.myCalendar.fullCalendar('renderEvents', this.modalData)
console.log(this.modalData);
console.log(response);
});