|
132 | 132 | * Private functions |
133 | 133 | * |
134 | 134 | ********************************************************************************/ |
| 135 | + |
| 136 | + hasTimeZone = function () { |
| 137 | + return moment.tz !== undefined && options.timeZone !== undefined && options.timeZone !== null && options.timeZone !== ''; |
| 138 | + }, |
| 139 | + |
135 | 140 | getMoment = function (d) { |
136 | 141 | var returnMoment; |
137 | 142 |
|
|
178 | 183 | return (isEnabled('h') || isEnabled('m') || isEnabled('s')); |
179 | 184 | }, |
180 | 185 |
|
181 | | - hasTimeZone = function () { |
182 | | - return moment.tz !== undefined && options.timeZone !== undefined && options.timeZone !== null && options.timeZone !== ''; |
183 | | - }, |
184 | | - |
185 | 186 | hasDate = function () { |
186 | 187 | return (isEnabled('y') || isEnabled('M') || isEnabled('d')); |
187 | 188 | }, |
|
233 | 234 |
|
234 | 235 | if (isEnabled('h')) { |
235 | 236 | topRow.append($('<td>') |
236 | | - .append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.incrementHour}).addClass('btn').attr('data-action', 'incrementHours') |
237 | | - .append($('<span>').addClass(options.icons.up)))); |
| 237 | + .append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.incrementHour }).addClass('btn').attr('data-action', 'incrementHours').append($('<span>').addClass(options.icons.up)))); |
238 | 238 | middleRow.append($('<td>') |
239 | | - .append($('<span>').addClass('timepicker-hour').attr({'data-time-component': 'hours', 'title': options.tooltips.pickHour}).attr('data-action', 'showHours'))); |
| 239 | + .append($('<span>').addClass('timepicker-hour').attr({ 'data-time-component': 'hours', 'title': options.tooltips.pickHour }).attr('data-action', 'showHours'))); |
240 | 240 | bottomRow.append($('<td>') |
241 | | - .append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.decrementHour}).addClass('btn').attr('data-action', 'decrementHours') |
242 | | - .append($('<span>').addClass(options.icons.down)))); |
| 241 | + .append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.decrementHour }).addClass('btn').attr('data-action', 'decrementHours').append($('<span>').addClass(options.icons.down)))); |
243 | 242 | } |
244 | 243 | if (isEnabled('m')) { |
245 | 244 | if (isEnabled('h')) { |
|
248 | 247 | bottomRow.append($('<td>').addClass('separator')); |
249 | 248 | } |
250 | 249 | topRow.append($('<td>') |
251 | | - .append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.incrementMinute}).addClass('btn').attr('data-action', 'incrementMinutes') |
| 250 | + .append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.incrementMinute }).addClass('btn').attr('data-action', 'incrementMinutes') |
252 | 251 | .append($('<span>').addClass(options.icons.up)))); |
253 | 252 | middleRow.append($('<td>') |
254 | | - .append($('<span>').addClass('timepicker-minute').attr({'data-time-component': 'minutes', 'title': options.tooltips.pickMinute}).attr('data-action', 'showMinutes'))); |
| 253 | + .append($('<span>').addClass('timepicker-minute').attr({ 'data-time-component': 'minutes', 'title': options.tooltips.pickMinute }).attr('data-action', 'showMinutes'))); |
255 | 254 | bottomRow.append($('<td>') |
256 | | - .append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.decrementMinute}).addClass('btn').attr('data-action', 'decrementMinutes') |
| 255 | + .append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.decrementMinute }).addClass('btn').attr('data-action', 'decrementMinutes') |
257 | 256 | .append($('<span>').addClass(options.icons.down)))); |
258 | 257 | } |
259 | 258 | if (isEnabled('s')) { |
|
263 | 262 | bottomRow.append($('<td>').addClass('separator')); |
264 | 263 | } |
265 | 264 | topRow.append($('<td>') |
266 | | - .append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.incrementSecond}).addClass('btn').attr('data-action', 'incrementSeconds') |
| 265 | + .append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.incrementSecond }).addClass('btn').attr('data-action', 'incrementSeconds') |
267 | 266 | .append($('<span>').addClass(options.icons.up)))); |
268 | 267 | middleRow.append($('<td>') |
269 | | - .append($('<span>').addClass('timepicker-second').attr({'data-time-component': 'seconds', 'title': options.tooltips.pickSecond}).attr('data-action', 'showSeconds'))); |
| 268 | + .append($('<span>').addClass('timepicker-second').attr({ 'data-time-component': 'seconds', 'title': options.tooltips.pickSecond }).attr('data-action', 'showSeconds'))); |
270 | 269 | bottomRow.append($('<td>') |
271 | | - .append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.decrementSecond}).addClass('btn').attr('data-action', 'decrementSeconds') |
| 270 | + .append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.decrementSecond }).addClass('btn').attr('data-action', 'decrementSeconds') |
272 | 271 | .append($('<span>').addClass(options.icons.down)))); |
273 | 272 | } |
274 | 273 |
|
275 | 274 | if (!use24Hours) { |
276 | 275 | topRow.append($('<td>').addClass('separator')); |
277 | 276 | middleRow.append($('<td>') |
278 | | - .append($('<button>').addClass('btn btn-primary').attr({'data-action': 'togglePeriod', tabindex: '-1', 'title': options.tooltips.togglePeriod}))); |
| 277 | + .append($('<button>').addClass('btn btn-primary').attr({ 'data-action': 'togglePeriod', tabindex: '-1', 'title': options.tooltips.togglePeriod }))); |
279 | 278 | bottomRow.append($('<td>').addClass('separator')); |
280 | 279 | } |
281 | 280 |
|
|
309 | 308 | getToolbar = function () { |
310 | 309 | var row = []; |
311 | 310 | if (options.showTodayButton) { |
312 | | - row.push($('<td>').append($('<a>').attr({'data-action': 'today', 'title': options.tooltips.today}).append($('<span>').addClass(options.icons.today)))); |
| 311 | + row.push($('<td>').append($('<a>').attr({ 'data-action': 'today', 'title': options.tooltips.today }).append($('<span>').addClass(options.icons.today)))); |
313 | 312 | } |
314 | 313 | if (!options.sideBySide && hasDate() && hasTime()) { |
315 | | - row.push($('<td>').append($('<a>').attr({'data-action': 'togglePicker', 'title': options.tooltips.selectTime}).append($('<span>').addClass(options.icons.time)))); |
| 314 | + row.push($('<td>').append($('<a>').attr({ 'data-action': 'togglePicker', 'title': options.tooltips.selectTime }).append($('<span>').addClass(options.icons.time)))); |
316 | 315 | } |
317 | 316 | if (options.showClear) { |
318 | | - row.push($('<td>').append($('<a>').attr({'data-action': 'clear', 'title': options.tooltips.clear}).append($('<span>').addClass(options.icons.clear)))); |
| 317 | + row.push($('<td>').append($('<a>').attr({ 'data-action': 'clear', 'title': options.tooltips.clear }).append($('<span>').addClass(options.icons.clear)))); |
319 | 318 | } |
320 | 319 | if (options.showClose) { |
321 | | - row.push($('<td>').append($('<a>').attr({'data-action': 'close', 'title': options.tooltips.close}).append($('<span>').addClass(options.icons.close)))); |
| 320 | + row.push($('<td>').append($('<a>').attr({ 'data-action': 'close', 'title': options.tooltips.close }).append($('<span>').addClass(options.icons.close)))); |
322 | 321 | } |
323 | 322 | return $('<table>').addClass('table-condensed').append($('<tbody>').append($('<tr>').append(row))); |
324 | 323 | }, |
|
644 | 643 | updateDecades = function () { |
645 | 644 | var decadesView = widget.find('.datepicker-decades'), |
646 | 645 | decadesViewHeader = decadesView.find('th'), |
647 | | - startDecade = moment({y: viewDate.year() - (viewDate.year() % 100) - 1}), |
| 646 | + startDecade = moment({ y: viewDate.year() - (viewDate.year() % 100) - 1 }), |
648 | 647 | endDecade = startDecade.clone().add(100, 'y'), |
649 | 648 | startedAt = startDecade.clone(), |
650 | 649 | minDateDecade = false, |
|
657 | 656 |
|
658 | 657 | decadesView.find('.disabled').removeClass('disabled'); |
659 | 658 |
|
660 | | - if (startDecade.isSame(moment({y: 1900})) || (options.minDate && options.minDate.isAfter(startDecade, 'y'))) { |
| 659 | + if (startDecade.isSame(moment({ y: 1900 })) || (options.minDate && options.minDate.isAfter(startDecade, 'y'))) { |
661 | 660 | decadesViewHeader.eq(0).addClass('disabled'); |
662 | 661 | } |
663 | 662 |
|
664 | 663 | decadesViewHeader.eq(1).text(startDecade.year() + '-' + endDecade.year()); |
665 | 664 |
|
666 | | - if (startDecade.isSame(moment({y: 2000})) || (options.maxDate && options.maxDate.isBefore(endDecade, 'y'))) { |
| 665 | + if (startDecade.isSame(moment({ y: 2000 })) || (options.maxDate && options.maxDate.isBefore(endDecade, 'y'))) { |
667 | 666 | decadesViewHeader.eq(2).addClass('disabled'); |
668 | 667 | } |
669 | 668 |
|
|
2293 | 2292 | }; |
2294 | 2293 | /** |
2295 | 2294 | * Returns the component's model current viewDate, a moment object or null if not set. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration. |
2296 | | - * @param {Takes string, viewDate, moment, null parameter.} newDate |
2297 | | - * @returns {viewDate.clone()} |
| 2295 | + * @param {Takes string, viewDate, moment, null parameter.} newDate |
| 2296 | + * @returns {viewDate.clone()} |
2298 | 2297 | */ |
2299 | | - |
2300 | 2298 | picker.viewDate = function (newDate) { |
2301 | 2299 | if (arguments.length === 0) { |
2302 | 2300 | return viewDate.clone(); |
|
2377 | 2375 | /** |
2378 | 2376 | * See (http://jquery.com/). |
2379 | 2377 | * @name jQuery |
2380 | | - * @class |
| 2378 | + * @class |
2381 | 2379 | * See the jQuery Library (http://jquery.com/) for full details. This just |
2382 | 2380 | * documents the function and classes that are added to jQuery by this plug-in. |
2383 | 2381 | */ |
2384 | | - |
2385 | 2382 | /** |
2386 | 2383 | * See (http://jquery.com/) |
2387 | 2384 | * @name fn |
2388 | | - * @class |
| 2385 | + * @class |
2389 | 2386 | * See the jQuery Library (http://jquery.com/) for full details. This just |
2390 | 2387 | * documents the function and classes that are added to jQuery by this plug-in. |
2391 | 2388 | * @memberOf jQuery |
2392 | 2389 | */ |
2393 | | - |
2394 | 2390 | /** |
2395 | 2391 | * Show comments |
2396 | 2392 | * @class datetimepicker |
|
0 commit comments