From 54e1a715be3ef0bdfdb45b6fde99912d6e19fca6 Mon Sep 17 00:00:00 2001 From: Vasilii Burlacu Date: Wed, 20 Jun 2018 22:52:50 +0300 Subject: [PATCH] MAGETWO-61209: Fixed issue with mage/calendar when setting `numberOfMonths` to show more than 1 month --- lib/web/mage/calendar.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/web/mage/calendar.js b/lib/web/mage/calendar.js index 51ee9b3a8891a..ac154b333801d 100644 --- a/lib/web/mage/calendar.js +++ b/lib/web/mage/calendar.js @@ -236,12 +236,14 @@ firstDay = parseInt(this._get(inst, 'firstDay'), 10); firstDay = isNaN(firstDay) ? 0 : firstDay; - for (row; row < numMonths[0]; row++) { + for (row = 0; row < numMonths[0]; row++) { this.maxRows = 4; - for (col; col < numMonths[1]; col++) { + for (col = 0; col < numMonths[1]; col++) { selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); + calender = ''; + if (isMultiMonth) { calender += '
' + this._get(inst, 'weekHeader') + '' : ''; - for (dow; dow < 7; dow++) { // days of the week + for (dow = 0; dow < 7; dow++) { // days of the week day = (dow + firstDay) % 7; thead += '= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + @@ -289,7 +291,7 @@ this.maxRows = numRows; printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); - for (dRow; dRow < numRows; dRow++) { // create date picker rows + for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows calender += ''; tbody = !showWeek ? '' : '' + this._get(inst, 'calculateWeek')(printDate) + '';