angular-material-components icon indicating copy to clipboard operation
angular-material-components copied to clipboard

Setting [min]=minDate after today/now won't change the default date highlight to minDate after date-time picker view

Open klimtron opened this issue 3 years ago • 2 comments

Hi there, while I'm setting [min]="minDate" and it is after today/now, it won't change the default set date to minDate after date-time picker display. image like in the default mat-datepicker: image circle is "today", and filled with background is the default first available

klimtron avatar Apr 11 '21 20:04 klimtron

Hi, I can confirm this. Seems the [startAt] input is not working. As a workaround I used this:

@ViewChild('toPicker') toPicker: NgxMatDatetimePicker<Date>; this.toPicker._selected = seletedToDate; this.toPicker.startAt = seletedToDate;

this modifies the "private" (nothing ever is private in javascript) attribute in the object. SelectedDate var is obviously whatever you want the date to be.

This is a massive hack though.

kofizzz avatar Jun 07 '21 15:06 kofizzz

Hi, I can confirm this. Seems the [startAt] input is not working. As a workaround I used this:

@ViewChild('toPicker') toPicker: NgxMatDatetimePicker<Date>; this.toPicker._selected = seletedToDate; this.toPicker.startAt = seletedToDate;

this modifies the "private" (nothing ever is private in javascript) attribute in the object. SelectedDate var is obviously whatever you want the date to be.

This is a massive hack though.

Hey. Found solution without modifying 'private' value (but still not the clearest way IMO). Anyway, maybe it'll help someone :) instead of using this.toPicker._selected = seletedToDate; this.toPicker.startAt = seletedToDate; try to use this.toPicker.open(); this.toPicker.close(); this.toPicker.select(seletedToDate);

Or you can use 'opened' event: HTML <ngx-mat-datetime-picker #toPicker (opened)="openedDate()"></ngx-mat-datetime-picker> TS openedDate() { this.toPicker.select(seletedToDate); }

NumKied avatar Jul 26 '21 17:07 NumKied