vendor/assets/javascripts/bootstrap-datetimepicker.js in bootstrap3-datetimepicker-rails-2.1.20 vs vendor/assets/javascripts/bootstrap-datetimepicker.js in bootstrap3-datetimepicker-rails-2.1.20.1
- old
+ new
@@ -40,17 +40,17 @@
}
}
}
(function ($, moment) {
- if (typeof moment === 'undefined') {
+ if (typeof moment === 'undefined') {
alert("momentjs is requried");
- throw new Error('momentjs is required');
+ throw new Error('momentjs is requried');
};
-
+
var dpgId = 0,
-
+
pMoment = moment,
// ReSharper disable once InconsistentNaming
DateTimePicker = function (element, options) {
var defaults = {
@@ -60,11 +60,11 @@
useSeconds: false,
minuteStepping: 1,
startDate: new pMoment({ y: 1970 }),
endDate: new pMoment().add(50, "y"),
collapse: true,
- language: pMoment.lang(),
+ language: "en",
defaultDate: "",
disabledDates: [],
enabledDates: false,
icons: {},
useStrict: false
@@ -82,15 +82,15 @@
init = function () {
var icon = false, i, dDate, longDateFormat;
picker.options = $.extend({}, defaults, options);
picker.options.icons = $.extend({}, icons, picker.options.icons);
-
+
picker.element = $(element);
-
+
dataToOptions();
-
+
if (!(picker.options.pickTime || picker.options.pickDate))
throw new Error('Must choose at least one picker');
picker.id = dpgId++;
pMoment.lang(picker.options.language);
@@ -199,11 +199,11 @@
update();
showMode();
attachDatePickerEvents();
if (picker.options.defaultDate !== "") picker.setValue(picker.options.defaultDate);
},
-
+
dataToOptions = function () {
var eData = picker.element.data();
if (eData.pickdate !== undefined) picker.options.pickDate = eData.pickdate;
if (eData.picktime !== undefined) picker.options.pickTime = eData.picktime;
if (eData.useminutes !== undefined) picker.options.useMinutes = eData.useminutes;
@@ -264,11 +264,11 @@
picker.element.trigger({
type: 'change.dp',
date: pMoment(picker.date),
oldDate: pMoment(oldDate)
});
-
+
if (eventType !== 'change')
picker.element.change();
},
notifyError = function (date) {
@@ -450,11 +450,11 @@
}
html += '</tr>';
}
table.html(html);
},
-
+
fillSeconds = function () {
var table = picker.widget.find('.timepicker .timepicker-seconds table'), html = '', current = 0, i, j;
table.parent().hide();
for (i = 0; i < 5; i++) {
html += '<tr>';
@@ -639,11 +639,11 @@
var oldDate = pMoment(picker.date), action = $(e.currentTarget).data('action'), rv = actions[action].apply(picker, arguments);
stopEvent(e);
if (!picker.date) picker.date = pMoment({ y: 1970 });
set();
fillTime();
- notifyChange(oldDate, e.type);
+ notifyChange(oldDate);
return rv;
},
stopEvent = function (e) {
e.stopPropagation();
@@ -654,17 +654,17 @@
pMoment.lang(picker.options.language);
var input = $(e.target), oldDate = pMoment(picker.date), d = pMoment(input.val(), picker.format, picker.options.useStrict);
if (d.isValid()) {
update();
picker.setValue(d);
- notifyChange(oldDate, e.type);
+ notifyChange(oldDate);
set();
}
else {
picker.viewDate = oldDate;
//picker.setValue(""); // unset the date when the input is erased
- notifyChange(oldDate, e.type);
+ notifyChange(oldDate);
notifyError(d);
picker.unset = true;
input.val('');
}
},
@@ -1053,11 +1053,11 @@
picker.setEnabledDates = function (dates) {
if (!dates) picker.options.enabledDates = false;
else picker.options.enabledDates = dates;
if (picker.viewDate) update();
},
-
+
picker.setEndDate = function (date) {
picker.options.endDate = pMoment(date);
if (!picker.options.endDate.isValid()) {
picker.options.endDate = pMoment().add(50, "y");
}
@@ -1079,6 +1079,6 @@
return this.each(function () {
var $this = $(this), data = $this.data('DateTimePicker');
if (!data) $this.data('DateTimePicker', new DateTimePicker(this, options));
});
};
-}));
+}));
\ No newline at end of file