diff --git a/packages/date-picker/src/vaadin-month-calendar-mixin.js b/packages/date-picker/src/vaadin-month-calendar-mixin.js index 0220a38ffa..9984718e66 100644 --- a/packages/date-picker/src/vaadin-month-calendar-mixin.js +++ b/packages/date-picker/src/vaadin-month-calendar-mixin.js @@ -188,12 +188,14 @@ export const MonthCalendarMixin = (superClass) => const weekDayNamesShort = this._applyFirstDayOfWeek(weekdaysShort, firstDayOfWeek); const weekDayNames = this._applyFirstDayOfWeek(weekdays, firstDayOfWeek); - return weekDayNames.map((day, index) => { - return { - weekDay: day, - weekDayShort: weekDayNamesShort[index], - }; - }); + return weekDayNames + .map((day, index) => { + return { + weekDay: day, + weekDayShort: weekDayNamesShort[index], + }; + }) + .slice(0, 7); } /** @private */ diff --git a/packages/date-picker/test/month-calendar.common.js b/packages/date-picker/test/month-calendar.common.js index 12e07bd505..6ea1ba64ca 100644 --- a/packages/date-picker/test/month-calendar.common.js +++ b/packages/date-picker/test/month-calendar.common.js @@ -64,6 +64,18 @@ describe('vaadin-month-calendar', () => { expect(monthCalendar.shadowRoot.querySelector('[part="month-header"]').textContent).to.equal('January 2000'); }); + it('should render at most 7 weekdays', async () => { + monthCalendar.i18n = { + ...monthCalendar.i18n, + weekdays: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'], + weekdaysShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'], + }; + await nextRender(); + + const weekdays = getWeekDayCells(monthCalendar); + expect(weekdays.length).to.equal(7); + }); + it('should fire value change on tap', () => { const dateElements = getDateCells(monthCalendar); tap(dateElements[10]);