angular_components icon indicating copy to clipboard operation
angular_components copied to clipboard

The calendar doesn't automatically scroll to the current day

Open salojoo opened this issue 6 years ago • 1 comments

MaterialCalendarPickerComponent opens to minDate by default, instead of scrolling to today

As a work-around one can reference the component with ViewChild, and scroll in OnInit()

@ViewChild(MaterialCalendarPickerComponent) MaterialCalendarPickerComponent calendarPickerComponent;

ngOnInit() async { calendarPickerComponent.scrollToDate(Date.today()); }

salojoo avatar May 25 '19 18:05 salojoo

My work-around maybe only works, because I have some async code for delay in the onInit function

So a better solution would be to use a timer

ngOnInit() { Timer.run(() => calendarPickerComponent.scrollToDate(Date.today())); }

salojoo avatar May 25 '19 19:05 salojoo