matheo/angular

TimePicker Bug

hennihaus opened this issue · 2 comments

Hello matheo,

is this a timePicker bug or have I made any mistake?

core.js:6150 ERROR TypeError: Cannot read property 'getUnit' of undefined
    at dateInputsHaveChanged (matheo-datepicker.js:4560)
    at MatDatepickerInput.ngOnChanges (matheo-datepicker.js:4393)
    at MatDatepickerInput.rememberChangeHistoryAndInvokeOnChangesHook (core.js:1506)
    at callHook (core.js:2525)
    at callHooks (core.js:2492)
    at executeCheckHooks (core.js:2424)
    at selectIndexInternal (core.js:8383)
    at Module.ɵɵadvance (core.js:8372)
    at JourneySearchComponent_Template (journey-search.component.html:36)
    at executeTemplate (core.js:9538)
  <mat-form-field appearance='standard'>
    <mat-label>Uhrzeit</mat-label>
    <input matInput [matDatepicker]='this.timePicker' formControlName='time'>
    <mat-datepicker touchUi #timePicker type='time' [twelveHour]='false'></mat-datepicker>
    <mat-error>Bitte wähle eine korrekte Uhrzeit aus</mat-error>
  </mat-form-field>
    this.apiTokenForm = this.formBuilder.group({
      departureTravelPoint: [null, [Validators.required, TravelPointValidators.pointFormat]],
      arrivalTravelPoint: [null, [Validators.required, TravelPointValidators.pointFormat]],
      date: [new Date(), Validators.required],
      time: [new Date(), Validators.required],
      isArrivalDateTime: [false]
    }, {
      updateOn: 'submit'
    });

Hi @hennihaus
Did you provide MatNativeDateModule in your root module or next to the MatDatepickerModule?

I've released a fix on @matheo/datepicker v11.2.7 :)