Topic: [Angular] [Date Picker]
maury844 free asked 6 years ago
Hi again,
I've been trying to use Date Picker but this error keeps coming up, it points to the datepickerUtil.service.ts.
ERROR TypeError: Cannot read property 'length' of undefined at UtilService.isDisabledDay (datepickerUtil.service.ts:132) at MDBDatePickerComponent.isTodayDisabled (datepicker.component.ts:290) at MDBDatePickerComponent.parseOptions (datepicker.component.ts:304) at MDBDatePickerComponent.ngOnChanges (datepicker.component.ts:355) I have added the myDatepickerOptions to the component.ts as well.
Damian Gemza staff answered 6 years ago
IRoman pro answered 6 years ago
IRoman pro answered 6 years ago
maury844 free answered 6 years ago
Well I'm using the dateTime picker in a form, where I want the user to pass in a Date, I have taken away all the unnecesary code from the snippet below.
<a (click)="optionalFields.toggle()" style="font-size: 22px;"> Optional Fields</a>
<div id='optional-fields' [mdbCollapse]="!isRequiredShown" #optionalFields="bs-collapse" aria-expanded="false" class="in"
(showBsCollapse)="showOptionalFields()" (hideBsCollapse)="hideOptionalFields()">
<div class="md-form form-sm">
<mdb-date-picker name="mydate" [options]="myDatePickerOptions" [placeholder]="'Waiver Expiry Date'" [formControl]="createForm.controls['waiverExpiry']" required></mdb-date-picker>
</div>
</div>
Then in the component.ts I have added the dateTimePickerOptions you guys provide in the tutorial (the default ones), and basically that's it, whenever I try clicking on the datetimePicker, I get that exception I pointed out, and the 'body' of the picker appears with no labels, no numbers and anything, just the 'modal' window.
Best Regards
Damian Gemza staff commented 6 years ago
Dear Maury, from your code I'm unable to reproduce your case because I can't test it on my computer. Could you provide me fully, working example ready to copy and test by me? It would help me to debug the problem. Or if there's a possibility, send me your project at d.gemza@mdbootstrap.com Best Regards, DamianDamian Gemza staff answered 6 years ago
maury844 free commented 6 years ago
I'm using the code found in the example for Angular MDB, basic one, also with the myDatepickerConfig object you provide to use the default settings. <a href="https://mdbootstrap.com/angular/advanced/datepicker/" rel="nofollow">https://mdbootstrap.com/angular/advanced/datepicker/</a>Damian Gemza staff commented 6 years ago
Please show me your code in new post. It's quite strange error and I want to check, in which way you're using our datePicker. I've tried to reproduce your error, but without any success. Best Regards, DamianFREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No