|
1 | | -/*! version : 4.14.30 |
| 1 | +/*! version : 4.15.35 |
2 | 2 | ========================================================= |
3 | 3 | bootstrap-datetimejs |
4 | 4 | https://github.com/Eonasdan/bootstrap-datetimepicker |
|
285 | 285 | getToolbar = function () { |
286 | 286 | var row = []; |
287 | 287 | if (options.showTodayButton) { |
288 | | - row.push($('<td>').append($('<a>').attr({'data-action':'today', 'title':'Go to today'}).append($('<span>').addClass(options.icons.today)))); |
| 288 | + row.push($('<td>').append($('<a>').attr({'data-action':'today', 'title': options.tooltips.today}).append($('<span>').addClass(options.icons.today)))); |
289 | 289 | } |
290 | 290 | if (!options.sideBySide && hasDate() && hasTime()) { |
291 | 291 | row.push($('<td>').append($('<a>').attr({'data-action':'togglePicker', 'title':'Select Time'}).append($('<span>').addClass(options.icons.time)))); |
292 | 292 | } |
293 | 293 | if (options.showClear) { |
294 | | - row.push($('<td>').append($('<a>').attr({'data-action':'clear', 'title':'Clear selection'}).append($('<span>').addClass(options.icons.clear)))); |
| 294 | + row.push($('<td>').append($('<a>').attr({'data-action':'clear', 'title': options.tooltips.clear}).append($('<span>').addClass(options.icons.clear)))); |
295 | 295 | } |
296 | 296 | if (options.showClose) { |
297 | | - row.push($('<td>').append($('<a>').attr({'data-action':'close', 'title':'Close the picker'}).append($('<span>').addClass(options.icons.close)))); |
| 297 | + row.push($('<td>').append($('<a>').attr({'data-action':'close', 'title': options.tooltips.close}).append($('<span>').addClass(options.icons.close)))); |
298 | 298 | } |
299 | 299 | return $('<table>').addClass('table-condensed').append($('<tbody>').append($('<tr>').append(row))); |
300 | 300 | }, |
|
316 | 316 | if (isEnabled('s') && !use24Hours) { |
317 | 317 | template.addClass('wider'); |
318 | 318 | } |
| 319 | + |
319 | 320 | if (options.sideBySide && hasDate() && hasTime()) { |
320 | 321 | template.addClass('timepicker-sbs'); |
| 322 | + if (options.toolbarPlacement === 'top') { |
| 323 | + template.append(toolbar); |
| 324 | + } |
321 | 325 | template.append( |
322 | 326 | $('<div>').addClass('row') |
323 | | - .append(dateView.addClass('col-sm-6')) |
324 | | - .append(timeView.addClass('col-sm-6')) |
| 327 | + .append(dateView.addClass('col-md-6')) |
| 328 | + .append(timeView.addClass('col-md-6')) |
325 | 329 | ); |
326 | | - template.append(toolbar); |
| 330 | + if (options.toolbarPlacement === 'bottom') { |
| 331 | + template.append(toolbar); |
| 332 | + } |
327 | 333 | return template; |
328 | 334 | } |
329 | 335 |
|
|
552 | 558 | monthsViewHeader = monthsView.find('th'), |
553 | 559 | months = monthsView.find('tbody').find('span'); |
554 | 560 |
|
555 | | - monthsViewHeader.eq(0).find('span').attr('title', 'Previous Year'); |
556 | | - monthsViewHeader.eq(1).attr('title', 'Select Year'); |
557 | | - monthsViewHeader.eq(2).find('span').attr('title', 'Next Year'); |
| 561 | + monthsViewHeader.eq(0).find('span').attr('title', options.tooltips.prevYear); |
| 562 | + monthsViewHeader.eq(1).attr('title', options.tooltips.selectYear); |
| 563 | + monthsViewHeader.eq(2).find('span').attr('title', options.tooltips.nextYear); |
558 | 564 |
|
559 | 565 | monthsView.find('.disabled').removeClass('disabled'); |
560 | 566 |
|
|
587 | 593 | endYear = viewDate.clone().add(6, 'y'), |
588 | 594 | html = ''; |
589 | 595 |
|
590 | | - yearsViewHeader.eq(0).find('span').attr('title', 'Previous Decade'); |
591 | | - yearsViewHeader.eq(1).attr('title', 'Select Decade'); |
592 | | - yearsViewHeader.eq(2).find('span').attr('title', 'Next Decade'); |
| 596 | + yearsViewHeader.eq(0).find('span').attr('title', options.tooltips.nextDecade); |
| 597 | + yearsViewHeader.eq(1).attr('title', options.tooltips.selectDecade); |
| 598 | + yearsViewHeader.eq(2).find('span').attr('title', options.tooltips.prevDecade); |
593 | 599 |
|
594 | 600 | yearsView.find('.disabled').removeClass('disabled'); |
595 | 601 |
|
|
618 | 624 | endDecade = startDecade.clone().add(100, 'y'), |
619 | 625 | html = ''; |
620 | 626 |
|
621 | | - decadesViewHeader.eq(0).find('span').attr('title', 'Previous Century'); |
622 | | - decadesViewHeader.eq(2).find('span').attr('title', 'Next Century'); |
| 627 | + decadesViewHeader.eq(0).find('span').attr('title', options.tooltips.prevCentury); |
| 628 | + decadesViewHeader.eq(2).find('span').attr('title', options.tooltips.nextCentury); |
623 | 629 |
|
624 | 630 | decadesView.find('.disabled').removeClass('disabled'); |
625 | 631 |
|
|
656 | 662 | return; |
657 | 663 | } |
658 | 664 |
|
659 | | - daysViewHeader.eq(0).find('span').attr('title', 'Previous Month'); |
660 | | - daysViewHeader.eq(1).attr('title', 'Select Month'); |
661 | | - daysViewHeader.eq(2).find('span').attr('title', 'Next Month'); |
| 665 | + daysViewHeader.eq(0).find('span').attr('title', options.tooltips.prevMonth); |
| 666 | + daysViewHeader.eq(1).attr('title', options.tooltips.selectMonth); |
| 667 | + daysViewHeader.eq(2).find('span').attr('title', options.tooltips.nextMonth); |
662 | 668 |
|
663 | 669 | daysView.find('.disabled').removeClass('disabled'); |
664 | 670 | daysViewHeader.eq(1).text(viewDate.format(options.dayViewHeaderFormat)); |
|
880 | 886 | type: 'dp.hide', |
881 | 887 | date: date.clone() |
882 | 888 | }); |
| 889 | + |
| 890 | + input.blur(); |
| 891 | + |
883 | 892 | return picker; |
884 | 893 | }, |
885 | 894 |
|
|
1284 | 1293 | detachDatePickerElementEvents = function () { |
1285 | 1294 | input.off({ |
1286 | 1295 | 'change': change, |
1287 | | - 'blur': hide, |
| 1296 | + 'blur': blur, |
1288 | 1297 | 'keydown': keydown, |
1289 | 1298 | 'keyup': keyup, |
1290 | 1299 | 'focus': options.allowInputToggle ? hide : '' |
|
1630 | 1639 | setValue(options.maxDate); |
1631 | 1640 | } |
1632 | 1641 | if (viewDate.isAfter(parsedDate)) { |
1633 | | - viewDate = parsedDate.clone(); |
| 1642 | + viewDate = parsedDate.clone().subtract(options.stepping, 'm'); |
1634 | 1643 | } |
1635 | 1644 | update(); |
1636 | 1645 | return picker; |
|
1666 | 1675 | setValue(options.minDate); |
1667 | 1676 | } |
1668 | 1677 | if (viewDate.isBefore(parsedDate)) { |
1669 | | - viewDate = parsedDate.clone(); |
| 1678 | + viewDate = parsedDate.clone().add(options.stepping, 'm'); |
1670 | 1679 | } |
1671 | 1680 | update(); |
1672 | 1681 | return picker; |
|
1798 | 1807 | return picker; |
1799 | 1808 | }; |
1800 | 1809 |
|
| 1810 | + picker.tooltips = function (tooltips) { |
| 1811 | + if (arguments.length === 0) { |
| 1812 | + return $.extend({}, options.tooltips); |
| 1813 | + } |
| 1814 | + |
| 1815 | + if (!(tooltips instanceof Object)) { |
| 1816 | + throw new TypeError('tooltips() expects parameter to be an Object'); |
| 1817 | + } |
| 1818 | + $.extend(options.tooltips, tooltips); |
| 1819 | + if (widget) { |
| 1820 | + hide(); |
| 1821 | + show(); |
| 1822 | + } |
| 1823 | + return picker; |
| 1824 | + }; |
| 1825 | + |
1801 | 1826 | picker.useStrict = function (useStrict) { |
1802 | 1827 | if (arguments.length === 0) { |
1803 | 1828 | return options.useStrict; |
|
2236 | 2261 | if (element.hasClass('input-group')) { |
2237 | 2262 | // in case there is more then one 'input-group-addon' Issue #48 |
2238 | 2263 | if (element.find('.datepickerbutton').size() === 0) { |
2239 | | - component = element.find('[class^="input-group-"]'); |
| 2264 | + component = element.find('.input-group-addon'); |
2240 | 2265 | } else { |
2241 | 2266 | component = element.find('.datepickerbutton'); |
2242 | 2267 | } |
|
2310 | 2335 | clear: 'glyphicon glyphicon-trash', |
2311 | 2336 | close: 'glyphicon glyphicon-remove' |
2312 | 2337 | }, |
| 2338 | + tooltips: { |
| 2339 | + today: 'Go to today', |
| 2340 | + clear: 'Clear selection', |
| 2341 | + close: 'Close the picker', |
| 2342 | + selectMonth: 'Select Month', |
| 2343 | + prevMonth: 'Previous Month', |
| 2344 | + nextMonth: 'Next Month', |
| 2345 | + selectYear: 'Select Year', |
| 2346 | + prevYear: 'Previous Year', |
| 2347 | + nextYear: 'Next Year', |
| 2348 | + selectDecade: 'Select Decade', |
| 2349 | + prevDecade: 'Previous Decade', |
| 2350 | + nextDecade: 'Next Decade', |
| 2351 | + prevCentury: 'Previous Century', |
| 2352 | + nextCentury: 'Next Century' |
| 2353 | + }, |
2313 | 2354 | useStrict: false, |
2314 | 2355 | sideBySide: false, |
2315 | 2356 | daysOfWeekDisabled: false, |
|
2339 | 2380 | if (widget.find('.datepicker').is(':visible')) { |
2340 | 2381 | this.date(d.clone().subtract(7, 'd')); |
2341 | 2382 | } else { |
2342 | | - this.date(d.clone().add(1, 'm')); |
| 2383 | + this.date(d.clone().add(this.stepping(), 'm')); |
2343 | 2384 | } |
2344 | 2385 | }, |
2345 | 2386 | down: function (widget) { |
|
2351 | 2392 | if (widget.find('.datepicker').is(':visible')) { |
2352 | 2393 | this.date(d.clone().add(7, 'd')); |
2353 | 2394 | } else { |
2354 | | - this.date(d.clone().subtract(1, 'm')); |
| 2395 | + this.date(d.clone().subtract(this.stepping(), 'm')); |
2355 | 2396 | } |
2356 | 2397 | }, |
2357 | 2398 | 'control up': function (widget) { |
|
0 commit comments