Skip to content

Commit e11a310

Browse files
committed
MAGETWO-53299: "Go Today" button is not working for dates range component
- name and getTimezoneDate method refactoring
1 parent ad780cb commit e11a310

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/web/mage/calendar.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* in order to have ability to know actual store time even if page hadn't been reloaded
3636
* @returns {Date}
3737
*/
38-
_getTimezoneDateDatepicker: function () {
38+
_getTimezoneDate: function () {
3939
// local time in ms
4040
var ms = Date.now(),
4141
options = $.calendarConfig ? $.calendarConfig : {};
@@ -58,7 +58,7 @@
5858
* @param {String|Object} target - the target input field or division or span
5959
*/
6060
_setTimezoneDateDatepicker: function (target) {
61-
this._setDateDatepicker(target, this._getTimezoneDateDatepicker());
61+
this._setDateDatepicker(target, this._getTimezoneDate());
6262
}
6363
});
6464

@@ -120,7 +120,7 @@
120120
* @return {String} html template
121121
*/
122122
$.datepicker.constructor.prototype._generateHTML = function (inst) {
123-
var today = this._getTimezoneDateDatepicker(),
123+
var today = this._getTimezoneDate(),
124124
isRTL = this._get(inst, 'isRTL'),
125125
showButtonPanel = this._get(inst, 'showButtonPanel'),
126126
hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'),
@@ -396,7 +396,7 @@
396396
* @return {Object} date
397397
*/
398398
getTimezoneDate: function () {
399-
return this.element[this._picker()]('getTimezoneDate');
399+
return datepickerPrototype._getTimezoneDate.call(this);
400400
}
401401
});
402402

@@ -549,10 +549,9 @@
549549
* @param {Object} el
550550
*/
551551
$.datepicker._gotoToday = function (el) {
552-
var pickerObject = $(el);
553552

554553
//Set date/time according to timezone offset
555-
pickerObject.datepicker('setTimezoneDate')
554+
$(el).datepicker('setTimezoneDate')
556555
// To ensure that user can re-select date field without clicking outside it first.
557556
.blur();
558557
};

0 commit comments

Comments
 (0)