vendor/assets/javascripts/base/_datepicker.js in active_frontend-14.0.77 vs vendor/assets/javascripts/base/_datepicker.js in active_frontend-14.0.78
- old
+ new
@@ -59,10 +59,11 @@
maxViewMode: 2,
menu: '<div class="datepicker dropmenu caret"></div>',
minViewMode: 0,
multidate: false,
multidateSeparator: ',',
+ onSetValCallback: function (value) {},
startDate: -Infinity,
startView: 0,
templates: {
leftArrow: '<i class="icon-chevron-left"></i>',
rightArrow: '<i class="icon-chevron-right"></i>'
@@ -286,20 +287,23 @@
} else {
return null;
}
};
- Datepicker.prototype.setValue = function () {
- this.$element.val(this.getFormattedDate());
+ Datepicker.prototype.setVal = function () {
+ var value = this.getFormattedDate();
+
+ this.$element.val(value);
+ this.options.onSetValCallback(value);
};
Datepicker.prototype.setDate = function (date, which) {
if (!which || which === 'date') this.toggleMultidate(date && new Date(date));
if (!which || which === 'view') this.$viewDate = date && new Date(date);
this.fill();
- this.setValue();
+ this.setVal();
if (!which || which !== 'view') this.triggerEvent('changeDate');
if (this.$element) this.$element.change();
if (!which || which === 'date') this.hideWidget();
};
@@ -326,11 +330,11 @@
Datepicker.prototype.setUTCDate = function () {
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
this.update.apply(this, $.map(args, this.utcToLocal));
this.triggerEvent('changeDate');
- this.setValue();
+ this.setVal();
};
Datepicker.prototype.updateAll = function () {
this.update();
this.updateWidgetArrows();
@@ -725,11 +729,11 @@
} else {
this.$viewDate = this.$Options.defaultViewDate;
}
if (fromArgs) {
- this.setValue();
+ this.setVal();
} else if (dates.length) {
if (String(oldDates) !== String(this.$dates)) this.triggerEvent('changeDate');
}
if (!this.$dates.length && oldDates.length) this.triggerEvent('clearDate');
@@ -951,10 +955,10 @@
if (!this.$widget.is(':visible')) return;
this.unapplyEvents(this.$eventsAlt);
this.$viewMode = this.$Options.startView;
- if (this.$Options.forceParse) this.setValue();
+ if (this.$Options.forceParse) this.setVal();
this.updateWidgetMode();
this.$widget.detach();
this.$container.remove();
this.triggerEvent('hideWidget');