Skip to content

Commit

Permalink
docs(material/datepicker): fix create control value when null (#28234)
Browse files Browse the repository at this point in the history
  • Loading branch information
AleArevalo authored Dec 5, 2023
1 parent 0762d69 commit 8dc96a7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class DatepickerViewsSelectionExample {
date = new FormControl(moment());

setMonthAndYear(normalizedMonthAndYear: Moment, datepicker: MatDatepicker<Moment>) {
const ctrlValue = this.date.value!;
const ctrlValue = this.date.value ?? moment();
ctrlValue.month(normalizedMonthAndYear.month());
ctrlValue.year(normalizedMonthAndYear.year());
this.date.setValue(ctrlValue);
Expand Down

0 comments on commit 8dc96a7

Please sign in to comment.