@@ -304,6 +304,7 @@ export class MatCalendar<D> implements AfterContentInit, OnDestroy, OnChanges {
304
304
case ENTER :
305
305
if ( this . _dateFilterForViews ( this . _activeDate ) ) {
306
306
this . _dateSelected ( this . _activeDate ) ;
307
+ this . _userSelected ( ) ;
307
308
// Prevent unexpected default actions such as form submission.
308
309
event . preventDefault ( ) ;
309
310
}
@@ -367,22 +368,16 @@ export class MatCalendar<D> implements AfterContentInit, OnDestroy, OnChanges {
367
368
* calendar table.
368
369
*/
369
370
private _prevMonthInSameCol ( date : D ) : D {
370
- // Determine how many months to jump forward given that there are 2 empty slots at the beginning
371
- // of each year.
372
- let increment = this . _dateAdapter . getMonth ( date ) <= 4 ? - 5 :
373
- ( this . _dateAdapter . getMonth ( date ) >= 7 ? - 7 : - 12 ) ;
374
- return this . _dateAdapter . addCalendarMonths ( date , increment ) ;
371
+ // Decrement by 4 since there are 4 months per row.
372
+ return this . _dateAdapter . addCalendarMonths ( date , - 4 ) ;
375
373
}
376
374
377
375
/**
378
376
* Determine the date for the month that comes after the given month in the same column in the
379
377
* calendar table.
380
378
*/
381
379
private _nextMonthInSameCol ( date : D ) : D {
382
- // Determine how many months to jump forward given that there are 2 empty slots at the beginning
383
- // of each year.
384
- let increment = this . _dateAdapter . getMonth ( date ) <= 4 ? 7 :
385
- ( this . _dateAdapter . getMonth ( date ) >= 7 ? 5 : 12 ) ;
386
- return this . _dateAdapter . addCalendarMonths ( date , increment ) ;
380
+ // Increment by 4 since there are 4 months per row.
381
+ return this . _dateAdapter . addCalendarMonths ( date , 4 ) ;
387
382
}
388
383
}
0 commit comments