Skip to content

Commit a96f0a5

Browse files
crisbetommalerba
authored andcommitted
docs(datepicker): bump max date in example (#17662)
Currently the maximum date in one of the examples is January 1st 2020 which is coming up. These changes make it a bit more maintainable by setting it to December 31st one year in the future. Fixes #17657.
1 parent 93fdb00 commit a96f0a5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components-examples/material/datepicker/datepicker-min-max/datepicker-min-max-example.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import {Component} from '@angular/core';
77
styleUrls: ['datepicker-min-max-example.css'],
88
})
99
export class DatepickerMinMaxExample {
10-
minDate = new Date(2000, 0, 1);
11-
maxDate = new Date(2020, 0, 1);
10+
minDate: Date;
11+
maxDate: Date;
12+
13+
constructor() {
14+
// Set the minimum to January 1st 20 years in the past and December 31st a year in the future.
15+
const currentYear = new Date().getFullYear();
16+
this.minDate = new Date(currentYear - 20, 0, 1);
17+
this.maxDate = new Date(currentYear + 1, 11, 31);
18+
}
1219
}

0 commit comments

Comments
 (0)