I have a little problem becouse I want to use my function in options for bootstrap-datepicker. I have function to check that date is in array of dates:
isInArray(array, value) {
return !!array.find(item => {
return item.getTime() == value.getTime()
});
}
And I want to use it in this option (https://bootstrap-datepicker.readthedocs.io/en/latest/options.html#beforeshowmonth) so I put this to my options:
this.datepickerOptionsForMonths = {
minViewMode: 1,
format: "mm-yyyy",
startDate: this.dateFrom,
endDate: this.dateTo,
beforeShowMonth: function (date: Date) {
return this.isInArray(this.datepickerRange, date.getDate());
}
};
And now is the problem becouse compilation is completed, everything seems fine but then in console I'm getting errors:
this.isInArray is not a function
Maybe the problem is that I've already used this function in the same body where datepickerOptionsForMonths are (in ngOnInit). Can someone help me?