Multiple-Dates-Picker-for-jQuery-UI
Multiple-Dates-Picker-for-jQuery-UI copied to clipboard
Cannot read property 'defaultDate' of undefined in Angular 6
I found this error try to show a multidatespicker:
core.js:1673 ERROR TypeError: Cannot read property 'defaultDate' of undefined
at s._get (jquery-ui.min.js:9)
at s._getDefaultDate (jquery-ui.min.js:9)
at s._inlineDatepicker (jquery-ui.min.js:8)
at s._attachDatepicker (jquery-ui.min.js:8)
at HTMLDivElement.
My TypeScript:
var today = new Date();
var y = today.getFullYear();
var holidays = [];
holidays = data.holidays[0].Holidays.split(",");
console.log(holidays);
$("#holidayscalendar").multiDatesPicker({
addDates: holidays,
numberOfMonths: [4,3], // 4 rows of 3 columns each = 12 months
defaultDate: '1/1/'+y, // First day of the Calendar
firstDay: 1 // Start with Monday
});
and imported in index.html
<script src="assets/plugins/bower_components/jquery-ui-multidatespicker/jquery-ui.multidatespicker.js"></script>
I cannot see anything in the application, and receive the error.