@@ -312,6 +312,7 @@ export class MatCalendar<D> implements AfterContentInit, OnDestroy, OnChanges {
312
312
case ENTER :
313
313
if ( this . _dateFilterForViews ( this . _activeDate ) ) {
314
314
this . _dateSelected ( this . _activeDate ) ;
315
+ this . _userSelected ( ) ;
315
316
// Prevent unexpected default actions such as form submission.
316
317
event . preventDefault ( ) ;
317
318
}
@@ -375,23 +376,17 @@ export class MatCalendar<D> implements AfterContentInit, OnDestroy, OnChanges {
375
376
* calendar table.
376
377
*/
377
378
private _prevMonthInSameCol ( date : D ) : D {
378
- // Determine how many months to jump forward given that there are 2 empty slots at the beginning
379
- // of each year.
380
- let increment = this . _dateAdapter . getMonth ( date ) <= 4 ? - 5 :
381
- ( this . _dateAdapter . getMonth ( date ) >= 7 ? - 7 : - 12 ) ;
382
- return this . _dateAdapter . addCalendarMonths ( date , increment ) ;
379
+ // Decrement by 4 since there are 4 months per row.
380
+ return this . _dateAdapter . addCalendarMonths ( date , - 4 ) ;
383
381
}
384
382
385
383
/**
386
384
* Determine the date for the month that comes after the given month in the same column in the
387
385
* calendar table.
388
386
*/
389
387
private _nextMonthInSameCol ( date : D ) : D {
390
- // Determine how many months to jump forward given that there are 2 empty slots at the beginning
391
- // of each year.
392
- let increment = this . _dateAdapter . getMonth ( date ) <= 4 ? 7 :
393
- ( this . _dateAdapter . getMonth ( date ) >= 7 ? 5 : 12 ) ;
394
- return this . _dateAdapter . addCalendarMonths ( date , increment ) ;
388
+ // Increment by 4 since there are 4 months per row.
389
+ return this . _dateAdapter . addCalendarMonths ( date , 4 ) ;
395
390
}
396
391
397
392
/**
0 commit comments