Skip to content

Commit ee79340

Browse files
AleArevalocrisbeto
authored andcommitted
docs(material/datepicker): fix create control value when null (#28234)
(cherry picked from commit 8dc96a7)
1 parent 6c81026 commit ee79340

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components-examples/material/datepicker/datepicker-views-selection/datepicker-views-selection-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class DatepickerViewsSelectionExample {
6060
date = new FormControl(moment());
6161

6262
setMonthAndYear(normalizedMonthAndYear: Moment, datepicker: MatDatepicker<Moment>) {
63-
const ctrlValue = this.date.value!;
63+
const ctrlValue = this.date.value ?? moment();
6464
ctrlValue.month(normalizedMonthAndYear.month());
6565
ctrlValue.year(normalizedMonthAndYear.year());
6666
this.date.setValue(ctrlValue);

0 commit comments

Comments
 (0)