Skip to content

Commit 3952957

Browse files
committed
ACP2E-3097: Datepicker for product with multiple Customizable Options with date fields not working when placing order from admin
1 parent 1b3d250 commit 3952957

File tree

1 file changed

+38
-29
lines changed

1 file changed

+38
-29
lines changed

lib/web/mage/calendar.js

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ define([
236236
buttonPanel = showButtonPanel ?
237237
'<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
238238
(this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ' +
239-
'ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' +
240-
'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
239+
'ui-state-default ui-priority-secondary ui-corner-all"'
240+
+ ' data-handler="today" data-event="click"' + '>' + currentText + '</button>' : '') +
241+
(isRTL ? '' : controls) + '</div>' : '';
241242
firstDay = parseInt(this._get(inst, 'firstDay'), 10);
242243
firstDay = isNaN(firstDay) ? 0 : firstDay;
243244

@@ -254,19 +255,18 @@ define([
254255

255256
if (numMonths[1] > 1) {
256257
switch (col) {
257-
case 0:
258-
calender += ' ui-datepicker-group-first';
259-
cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left');
260-
break;
261-
262-
case numMonths[1] - 1:
263-
calender += ' ui-datepicker-group-last';
264-
cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right');
265-
break;
266-
267-
default:
268-
calender += ' ui-datepicker-group-middle';
269-
cornerClass = '';
258+
case 0:
259+
calender += ' ui-datepicker-group-first';
260+
cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left');
261+
break;
262+
case numMonths[1] - 1:
263+
calender += ' ui-datepicker-group-last';
264+
cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right');
265+
break;
266+
default:
267+
calender += ' ui-datepicker-group-middle';
268+
cornerClass = '';
269+
break;
270270
}
271271
}
272272
calender += '">';
@@ -284,8 +284,8 @@ define([
284284

285285
for (dow = 0; dow < 7; dow++) { // days of the week
286286
day = (dow + firstDay) % 7;
287-
thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ?
288-
' class="ui-datepicker-week-end"' : '') + '>' +
287+
thead += '<th' + (
288+
(dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
289289
'<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
290290
}
291291
calender += thead + '</tr></thead><tbody>';
@@ -312,26 +312,34 @@ define([
312312
unselectable = otherMonth && !selectOtherMonths || !daySettings[0] ||
313313
minDate && printDate < minDate || maxDate && printDate > maxDate;
314314
tbody += '<td class="' +
315-
((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
316-
(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
315+
// highlight weekends
316+
((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') +
317+
// highlight days from other months
318+
(otherMonth ? ' ui-datepicker-other-month' : '') +
317319
(printDate.getTime() === selectedDate.getTime() &&
318320
drawMonth === inst.selectedMonth && inst._keyEvent || // user pressed key
319321
defaultDate.getTime() === printDate.getTime() &&
320322
defaultDate.getTime() === selectedDate.getTime() ?
321323
// or defaultDate is current printedDate and defaultDate is selectedDate
322324
' ' + this._dayOverClass : '') + // highlight selected day
323325
(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled' : '') +
324-
(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
325-
(printDate.getTime() === currentDate.getTime() ? ' ' + this._currentClass : '') +
326-
(printDate.getDate() === today.getDate() && printDate.getMonth() === today.getMonth() &&
327-
printDate.getYear() === today.getYear() ? ' ui-datepicker-today' : '')) + '"' +
328-
((!otherMonth || showOtherMonths) && daySettings[2] ?
329-
' title="' + daySettings[2] + '"' : '') + // cell title
326+
// highlight custom dates
327+
(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] +
328+
(printDate.getTime() === currentDate.getTime() ?
329+
' ' + this._currentClass : '') +
330+
(
331+
printDate.getDate() === today.getDate() &&
332+
printDate.getMonth() === today.getMonth() &&
333+
printDate.getYear() === today.getYear() ? ' ui-datepicker-today' : ''
334+
)
335+
) + '"' + ((!otherMonth || showOtherMonths) && daySettings[2] ?
336+
' title="' + daySettings[2] + '"' : '') + // cell title
330337
(unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' +
331-
'' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' +
338+
'' + printDate.getMonth() + '" data-year="' +
339+
printDate.getFullYear() + '"') + '>' +
332340
(otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
333-
unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>'
334-
: '<a class="ui-state-default' +
341+
unselectable ? '<span class="ui-state-default">' + printDate.getDate() +
342+
'</span>' : '<a class="ui-state-default' +
335343
(printDate.getTime() === today.getTime() ? ' ' : '') +
336344
(printDate.getTime() === currentDate.getTime() ? ' ui-state-active' : '') +
337345
(otherMonth ? ' ui-priority-secondary' : '') +
@@ -349,7 +357,8 @@ define([
349357
drawYear++;
350358
}
351359
calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
352-
(numMonths[0] > 0 && col === numMonths[1] - 1 ? '<div class="ui-datepicker-row-break"></div>'
360+
(numMonths[0] > 0 && col === numMonths[1] - 1 ?
361+
'<div class="ui-datepicker-row-break"></div>'
353362
: '') : '');
354363
group += calender;
355364
}

0 commit comments

Comments
 (0)