Multiple-Dates-Picker-for-jQuery-UI icon indicating copy to clipboard operation
Multiple-Dates-Picker-for-jQuery-UI copied to clipboard

Cannot read property 'defaultDate' of undefined in Angular 6

Open basiltap opened this issue 6 years ago • 0 comments

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. (jquery-ui.min.js:9) at Function.each (jquery.js:374) at n.fn.init.each (jquery.js:139) at n.fn.init.t.fn.datepicker (jquery-ui.min.js:9) at HTMLDivElement.init (jquery-ui.multidatespicker.js:154) at HTMLDivElement. (jquery-ui.multidatespicker.js:461)

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.

basiltap avatar Jul 09 '19 10:07 basiltap