kuhnroyal / mat-datetimepicker

Material datetimepicker for @angular/material
MIT License
153 stars 84 forks source link

Min and Max dates not working #43

Open ghost opened 6 years ago

ghost commented 6 years ago
    <mat-datetimepicker #datetimePickerEnd type="datetime" [min]='minDate' openOnFocus="true" timeInterval="5" ></mat-datetimepicker>

Min date not working, however it works on md2. How am I able to get this to work?

Thanks

kuhnroyal commented 6 years ago

Make sure the date is of the correct type moment/date. There are examples in the repository. https://github.com/kuhnroyal/mat-datetimepicker/issues/34

kuhnroyal commented 5 years ago

Is this still an issue or did you solve your problem?

scastrec commented 5 years ago

Hi. Looks like I'm having the same issue. Everythings works great until i add [min]

The Angular error:

Can't bind to 'min' since it isn't a known property of 'mat-datetimepicker'.

  1. If 'mat-datetimepicker' is an Angular component and it has 'min' input, then verify that it is part of this module.

My HTML `

    <mat-datetimepicker-toggle [for]="datePicker" matSuffix></mat-datetimepicker-toggle>
    <mat-datetimepicker [min]="startDate" #datePicker type="date" openOnFocus="true"></mat-datetimepicker>
    <input matInput [matDatetimepicker]="datePicker" formControlName="DateBegin" required autocomplete="false" >

`

And in my component : startDate = moment();

I'm currently using the 2.0.1 version.

jcanning commented 5 years ago

@StephaneC I think it has to be applied to the input field not the mat-dattimepicker field