Skip to content

Commit b20f689

Browse files
committed
remove unnecessary code
1 parent 44c1361 commit b20f689

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/material/datepicker/month-view.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,20 +254,11 @@ export class MatMonthView<D> implements AfterContentInit, OnChanges, OnDestroy {
254254

255255
_dateBecomesActive(event: MatCalendarUserEvent<number>) {
256256
const date = event.value;
257-
const selectedYear = this._dateAdapter.getYear(this.activeDate);
258-
const selectedMonth = this._dateAdapter.getMonth(this.activeDate);
259-
const activeDate = this._dateAdapter.createDate(selectedYear, selectedMonth, date);
260-
let rangeStartDate: number | null;
261-
let rangeEndDate: number | null;
257+
const activeYear = this._dateAdapter.getYear(this.activeDate);
258+
const activeMonth = this._dateAdapter.getMonth(this.activeDate);
259+
const activeDate = this._dateAdapter.createDate(activeYear, activeMonth, date);
262260

263-
if (this._activeDate instanceof DateRange) {
264-
rangeStartDate = this._getDateInCurrentMonth(this._activeDate.start);
265-
rangeEndDate = this._getDateInCurrentMonth(this._activeDate.end);
266-
} else {
267-
rangeStartDate = rangeEndDate = this._getDateInCurrentMonth(this._activeDate);
268-
}
269-
270-
if (rangeStartDate !== date || rangeEndDate !== date) {
261+
if (!this._dateAdapter.sameDate(activeDate, this._activeDate)) {
271262
this.activeDateChange.emit(activeDate);
272263
}
273264

0 commit comments

Comments
 (0)