vendor/assets/javascripts/bootstrap-datetimepicker.js in bootstrap3-datetimepicker-rails-4.14.30 vs vendor/assets/javascripts/bootstrap-datetimepicker.js in bootstrap3-datetimepicker-rails-4.15.35
- old
+ new
@@ -1,6 +1,6 @@
-/*! version : 4.14.30
+/*! version : 4.15.35
=========================================================
bootstrap-datetimejs
https://github.com/Eonasdan/bootstrap-datetimepicker
Copyright (c) 2015 Jonathan Peterson
=========================================================
@@ -283,20 +283,20 @@
},
getToolbar = function () {
var row = [];
if (options.showTodayButton) {
- row.push($('<td>').append($('<a>').attr({'data-action':'today', 'title':'Go to today'}).append($('<span>').addClass(options.icons.today))));
+ row.push($('<td>').append($('<a>').attr({'data-action':'today', 'title': options.tooltips.today}).append($('<span>').addClass(options.icons.today))));
}
if (!options.sideBySide && hasDate() && hasTime()) {
row.push($('<td>').append($('<a>').attr({'data-action':'togglePicker', 'title':'Select Time'}).append($('<span>').addClass(options.icons.time))));
}
if (options.showClear) {
- row.push($('<td>').append($('<a>').attr({'data-action':'clear', 'title':'Clear selection'}).append($('<span>').addClass(options.icons.clear))));
+ row.push($('<td>').append($('<a>').attr({'data-action':'clear', 'title': options.tooltips.clear}).append($('<span>').addClass(options.icons.clear))));
}
if (options.showClose) {
- row.push($('<td>').append($('<a>').attr({'data-action':'close', 'title':'Close the picker'}).append($('<span>').addClass(options.icons.close))));
+ row.push($('<td>').append($('<a>').attr({'data-action':'close', 'title': options.tooltips.close}).append($('<span>').addClass(options.icons.close))));
}
return $('<table>').addClass('table-condensed').append($('<tbody>').append($('<tr>').append(row)));
},
getTemplate = function () {
@@ -314,18 +314,24 @@
template.addClass('usetwentyfour');
}
if (isEnabled('s') && !use24Hours) {
template.addClass('wider');
}
+
if (options.sideBySide && hasDate() && hasTime()) {
template.addClass('timepicker-sbs');
+ if (options.toolbarPlacement === 'top') {
+ template.append(toolbar);
+ }
template.append(
$('<div>').addClass('row')
- .append(dateView.addClass('col-sm-6'))
- .append(timeView.addClass('col-sm-6'))
+ .append(dateView.addClass('col-md-6'))
+ .append(timeView.addClass('col-md-6'))
);
- template.append(toolbar);
+ if (options.toolbarPlacement === 'bottom') {
+ template.append(toolbar);
+ }
return template;
}
if (options.toolbarPlacement === 'top') {
content.append(toolbar);
@@ -550,13 +556,13 @@
updateMonths = function () {
var monthsView = widget.find('.datepicker-months'),
monthsViewHeader = monthsView.find('th'),
months = monthsView.find('tbody').find('span');
- monthsViewHeader.eq(0).find('span').attr('title', 'Previous Year');
- monthsViewHeader.eq(1).attr('title', 'Select Year');
- monthsViewHeader.eq(2).find('span').attr('title', 'Next Year');
+ monthsViewHeader.eq(0).find('span').attr('title', options.tooltips.prevYear);
+ monthsViewHeader.eq(1).attr('title', options.tooltips.selectYear);
+ monthsViewHeader.eq(2).find('span').attr('title', options.tooltips.nextYear);
monthsView.find('.disabled').removeClass('disabled');
if (!isValid(viewDate.clone().subtract(1, 'y'), 'y')) {
monthsViewHeader.eq(0).addClass('disabled');
@@ -585,13 +591,13 @@
yearsViewHeader = yearsView.find('th'),
startYear = viewDate.clone().subtract(5, 'y'),
endYear = viewDate.clone().add(6, 'y'),
html = '';
- yearsViewHeader.eq(0).find('span').attr('title', 'Previous Decade');
- yearsViewHeader.eq(1).attr('title', 'Select Decade');
- yearsViewHeader.eq(2).find('span').attr('title', 'Next Decade');
+ yearsViewHeader.eq(0).find('span').attr('title', options.tooltips.nextDecade);
+ yearsViewHeader.eq(1).attr('title', options.tooltips.selectDecade);
+ yearsViewHeader.eq(2).find('span').attr('title', options.tooltips.prevDecade);
yearsView.find('.disabled').removeClass('disabled');
if (options.minDate && options.minDate.isAfter(startYear, 'y')) {
yearsViewHeader.eq(0).addClass('disabled');
@@ -616,12 +622,12 @@
decadesViewHeader = decadesView.find('th'),
startDecade = viewDate.isBefore(moment({y: 1999})) ? moment({y: 1899}) : moment({y: 1999}),
endDecade = startDecade.clone().add(100, 'y'),
html = '';
- decadesViewHeader.eq(0).find('span').attr('title', 'Previous Century');
- decadesViewHeader.eq(2).find('span').attr('title', 'Next Century');
+ decadesViewHeader.eq(0).find('span').attr('title', options.tooltips.prevCentury);
+ decadesViewHeader.eq(2).find('span').attr('title', options.tooltips.nextCentury);
decadesView.find('.disabled').removeClass('disabled');
if (startDecade.isSame(moment({y: 1900})) || (options.minDate && options.minDate.isAfter(startDecade, 'y'))) {
decadesViewHeader.eq(0).addClass('disabled');
@@ -654,13 +660,13 @@
if (!hasDate()) {
return;
}
- daysViewHeader.eq(0).find('span').attr('title', 'Previous Month');
- daysViewHeader.eq(1).attr('title', 'Select Month');
- daysViewHeader.eq(2).find('span').attr('title', 'Next Month');
+ daysViewHeader.eq(0).find('span').attr('title', options.tooltips.prevMonth);
+ daysViewHeader.eq(1).attr('title', options.tooltips.selectMonth);
+ daysViewHeader.eq(2).find('span').attr('title', options.tooltips.nextMonth);
daysView.find('.disabled').removeClass('disabled');
daysViewHeader.eq(1).text(viewDate.format(options.dayViewHeaderFormat));
if (!isValid(viewDate.clone().subtract(1, 'M'), 'M')) {
@@ -878,10 +884,13 @@
notifyEvent({
type: 'dp.hide',
date: date.clone()
});
+
+ input.blur();
+
return picker;
},
clear = function () {
setValue(null);
@@ -1282,11 +1291,11 @@
},
detachDatePickerElementEvents = function () {
input.off({
'change': change,
- 'blur': hide,
+ 'blur': blur,
'keydown': keydown,
'keyup': keyup,
'focus': options.allowInputToggle ? hide : ''
});
@@ -1628,11 +1637,11 @@
options.maxDate = parsedDate;
if (options.useCurrent && !options.keepInvalid && date.isAfter(maxDate)) {
setValue(options.maxDate);
}
if (viewDate.isAfter(parsedDate)) {
- viewDate = parsedDate.clone();
+ viewDate = parsedDate.clone().subtract(options.stepping, 'm');
}
update();
return picker;
};
@@ -1664,11 +1673,11 @@
options.minDate = parsedDate;
if (options.useCurrent && !options.keepInvalid && date.isBefore(minDate)) {
setValue(options.minDate);
}
if (viewDate.isBefore(parsedDate)) {
- viewDate = parsedDate.clone();
+ viewDate = parsedDate.clone().add(options.stepping, 'm');
}
update();
return picker;
};
@@ -1796,10 +1805,26 @@
show();
}
return picker;
};
+ picker.tooltips = function (tooltips) {
+ if (arguments.length === 0) {
+ return $.extend({}, options.tooltips);
+ }
+
+ if (!(tooltips instanceof Object)) {
+ throw new TypeError('tooltips() expects parameter to be an Object');
+ }
+ $.extend(options.tooltips, tooltips);
+ if (widget) {
+ hide();
+ show();
+ }
+ return picker;
+ };
+
picker.useStrict = function (useStrict) {
if (arguments.length === 0) {
return options.useStrict;
}
@@ -2234,11 +2259,11 @@
}
if (element.hasClass('input-group')) {
// in case there is more then one 'input-group-addon' Issue #48
if (element.find('.datepickerbutton').size() === 0) {
- component = element.find('[class^="input-group-"]');
+ component = element.find('.input-group-addon');
} else {
component = element.find('.datepickerbutton');
}
}
@@ -2308,10 +2333,26 @@
next: 'glyphicon glyphicon-chevron-right',
today: 'glyphicon glyphicon-screenshot',
clear: 'glyphicon glyphicon-trash',
close: 'glyphicon glyphicon-remove'
},
+ tooltips: {
+ today: 'Go to today',
+ clear: 'Clear selection',
+ close: 'Close the picker',
+ selectMonth: 'Select Month',
+ prevMonth: 'Previous Month',
+ nextMonth: 'Next Month',
+ selectYear: 'Select Year',
+ prevYear: 'Previous Year',
+ nextYear: 'Next Year',
+ selectDecade: 'Select Decade',
+ prevDecade: 'Previous Decade',
+ nextDecade: 'Next Decade',
+ prevCentury: 'Previous Century',
+ nextCentury: 'Next Century'
+ },
useStrict: false,
sideBySide: false,
daysOfWeekDisabled: false,
calendarWeeks: false,
viewMode: 'days',
@@ -2337,11 +2378,11 @@
}
var d = this.date() || moment();
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().subtract(7, 'd'));
} else {
- this.date(d.clone().add(1, 'm'));
+ this.date(d.clone().add(this.stepping(), 'm'));
}
},
down: function (widget) {
if (!widget) {
this.show();
@@ -2349,10 +2390,10 @@
}
var d = this.date() || moment();
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().add(7, 'd'));
} else {
- this.date(d.clone().subtract(1, 'm'));
+ this.date(d.clone().subtract(this.stepping(), 'm'));
}
},
'control up': function (widget) {
if (!widget) {
return;