@@ -144,16 +144,6 @@ export class MatMonthView<D> implements AfterContentInit {
144144 throw createMissingDateImplError ( 'MAT_DATE_FORMATS' ) ;
145145 }
146146
147- const firstDayOfWeek = this . _dateAdapter . getFirstDayOfWeek ( ) ;
148- const narrowWeekdays = this . _dateAdapter . getDayOfWeekNames ( 'narrow' ) ;
149- const longWeekdays = this . _dateAdapter . getDayOfWeekNames ( 'long' ) ;
150-
151- // Rotate the labels for days of the week based on the configured first day of the week.
152- let weekdays = longWeekdays . map ( ( long , i ) => {
153- return { long, narrow : narrowWeekdays [ i ] } ;
154- } ) ;
155- this . _weekdays = weekdays . slice ( firstDayOfWeek ) . concat ( weekdays . slice ( 0 , firstDayOfWeek ) ) ;
156-
157147 this . _activeDate = this . _dateAdapter . today ( ) ;
158148 }
159149
@@ -252,6 +242,7 @@ export class MatMonthView<D> implements AfterContentInit {
252242 ( DAYS_PER_WEEK + this . _dateAdapter . getDayOfWeek ( firstOfMonth ) -
253243 this . _dateAdapter . getFirstDayOfWeek ( ) ) % DAYS_PER_WEEK ;
254244
245+ this . _initWeekdays ( ) ;
255246 this . _createWeekCells ( ) ;
256247 this . _changeDetectorRef . markForCheck ( ) ;
257248 }
@@ -261,6 +252,19 @@ export class MatMonthView<D> implements AfterContentInit {
261252 this . _matCalendarBody . _focusActiveCell ( ) ;
262253 }
263254
255+ /** Initializes the weekdays. */
256+ private _initWeekdays ( ) {
257+ const firstDayOfWeek = this . _dateAdapter . getFirstDayOfWeek ( ) ;
258+ const narrowWeekdays = this . _dateAdapter . getDayOfWeekNames ( 'narrow' ) ;
259+ const longWeekdays = this . _dateAdapter . getDayOfWeekNames ( 'long' ) ;
260+
261+ // Rotate the labels for days of the week based on the configured first day of the week.
262+ let weekdays = longWeekdays . map ( ( long , i ) => {
263+ return { long, narrow : narrowWeekdays [ i ] } ;
264+ } ) ;
265+ this . _weekdays = weekdays . slice ( firstDayOfWeek ) . concat ( weekdays . slice ( 0 , firstDayOfWeek ) ) ;
266+ }
267+
264268 /** Creates MatCalendarCells for the dates in this month. */
265269 private _createWeekCells ( ) {
266270 const daysInMonth = this . _dateAdapter . getNumDaysInMonth ( this . activeDate ) ;
0 commit comments