angulardart/angular_components

The calendar doesn't automatically scroll to the current day

salojoo opened this issue · 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());
}

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()));
}