GPQAPP

Форк
0
/
tempusdominus-bootstrap-4.js 
3505 строк · 107.2 Кб
1
/*!@preserve
2
 * Tempus Dominus Bootstrap4 v5.39.0 (https://tempusdominus.github.io/bootstrap-4/)
3
 * Copyright 2016-2020 Jonathan Peterson and contributors
4
 * Licensed under MIT (https://github.com/tempusdominus/bootstrap-3/blob/master/LICENSE)
5
 */
6

7
if (typeof jQuery === 'undefined') {
8
  throw new Error('Tempus Dominus Bootstrap4\'s requires jQuery. jQuery must be included before Tempus Dominus Bootstrap4\'s JavaScript.');
9
}
10

11
+function ($) {
12
  var version = $.fn.jquery.split(' ')[0].split('.');
13
  if ((version[0] < 2 && version[1] < 9) || (version[0] === 1 && version[1] === 9 && version[2] < 1) || (version[0] >= 4)) {
14
    throw new Error('Tempus Dominus Bootstrap4\'s requires at least jQuery v3.0.0 but less than v4.0.0');
15
  }
16
}(jQuery);
17

18

19
if (typeof moment === 'undefined') {
20
  throw new Error('Tempus Dominus Bootstrap4\'s requires moment.js. Moment.js must be included before Tempus Dominus Bootstrap4\'s JavaScript.');
21
}
22

23
var version = moment.version.split('.')
24
if ((version[0] <= 2 && version[1] < 17) || (version[0] >= 3)) {
25
  throw new Error('Tempus Dominus Bootstrap4\'s requires at least moment.js v2.17.0 but less than v3.0.0');
26
}
27

28
+function () {
29

30
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
31

32
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
33

34
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
35

36
// ReSharper disable once InconsistentNaming
37
var DateTimePicker = function ($, moment) {
38
  function escapeRegExp(text) {
39
    return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
40
  }
41

42
  function isValidDate(date) {
43
    return Object.prototype.toString.call(date) === '[object Date]' && !isNaN(date.getTime());
44
  }
45

46
  function isValidDateTimeStr(str) {
47
    return isValidDate(new Date(str));
48
  } // ReSharper disable InconsistentNaming
49

50

51
  var trim = function trim(str) {
52
    return str.replace(/(^\s+)|(\s+$)/g, '');
53
  },
54
      NAME = 'datetimepicker',
55
      DATA_KEY = "" + NAME,
56
      EVENT_KEY = "." + DATA_KEY,
57
      DATA_API_KEY = '.data-api',
58
      Selector = {
59
    DATA_TOGGLE: "[data-toggle=\"" + DATA_KEY + "\"]"
60
  },
61
      ClassName = {
62
    INPUT: NAME + "-input"
63
  },
64
      Event = {
65
    CHANGE: "change" + EVENT_KEY,
66
    BLUR: "blur" + EVENT_KEY,
67
    KEYUP: "keyup" + EVENT_KEY,
68
    KEYDOWN: "keydown" + EVENT_KEY,
69
    FOCUS: "focus" + EVENT_KEY,
70
    CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
71
    //emitted
72
    UPDATE: "update" + EVENT_KEY,
73
    ERROR: "error" + EVENT_KEY,
74
    HIDE: "hide" + EVENT_KEY,
75
    SHOW: "show" + EVENT_KEY
76
  },
77
      DatePickerModes = [{
78
    CLASS_NAME: 'days',
79
    NAV_FUNCTION: 'M',
80
    NAV_STEP: 1
81
  }, {
82
    CLASS_NAME: 'months',
83
    NAV_FUNCTION: 'y',
84
    NAV_STEP: 1
85
  }, {
86
    CLASS_NAME: 'years',
87
    NAV_FUNCTION: 'y',
88
    NAV_STEP: 10
89
  }, {
90
    CLASS_NAME: 'decades',
91
    NAV_FUNCTION: 'y',
92
    NAV_STEP: 100
93
  }],
94
      KeyMap = {
95
    'up': 38,
96
    38: 'up',
97
    'down': 40,
98
    40: 'down',
99
    'left': 37,
100
    37: 'left',
101
    'right': 39,
102
    39: 'right',
103
    'tab': 9,
104
    9: 'tab',
105
    'escape': 27,
106
    27: 'escape',
107
    'enter': 13,
108
    13: 'enter',
109
    'pageUp': 33,
110
    33: 'pageUp',
111
    'pageDown': 34,
112
    34: 'pageDown',
113
    'shift': 16,
114
    16: 'shift',
115
    'control': 17,
116
    17: 'control',
117
    'space': 32,
118
    32: 'space',
119
    't': 84,
120
    84: 't',
121
    'delete': 46,
122
    46: 'delete'
123
  },
124
      ViewModes = ['times', 'days', 'months', 'years', 'decades'],
125
      keyState = {},
126
      keyPressHandled = {},
127
      optionsSortMap = {
128
    timeZone: -39,
129
    format: -38,
130
    dayViewHeaderFormat: -37,
131
    extraFormats: -36,
132
    stepping: -35,
133
    minDate: -34,
134
    maxDate: -33,
135
    useCurrent: -32,
136
    collapse: -31,
137
    locale: -30,
138
    defaultDate: -29,
139
    disabledDates: -28,
140
    enabledDates: -27,
141
    icons: -26,
142
    tooltips: -25,
143
    useStrict: -24,
144
    sideBySide: -23,
145
    daysOfWeekDisabled: -22,
146
    calendarWeeks: -21,
147
    viewMode: -20,
148
    toolbarPlacement: -19,
149
    buttons: -18,
150
    widgetPositioning: -17,
151
    widgetParent: -16,
152
    ignoreReadonly: -15,
153
    keepOpen: -14,
154
    focusOnShow: -13,
155
    inline: -12,
156
    keepInvalid: -11,
157
    keyBinds: -10,
158
    debug: -9,
159
    allowInputToggle: -8,
160
    disabledTimeIntervals: -7,
161
    disabledHours: -6,
162
    enabledHours: -5,
163
    viewDate: -4,
164
    allowMultidate: -3,
165
    multidateSeparator: -2,
166
    updateOnlyThroughDateOption: -1,
167
    date: 1
168
  },
169
      defaultFeatherIcons = {
170
    time: 'clock',
171
    date: 'calendar',
172
    up: 'arrow-up',
173
    down: 'arrow-down',
174
    previous: 'arrow-left',
175
    next: 'arrow-right',
176
    today: 'arrow-down-circle',
177
    clear: 'trash-2',
178
    close: 'x'
179
  };
180

181
  function optionsSortFn(optionKeyA, optionKeyB) {
182
    if (optionsSortMap[optionKeyA] && optionsSortMap[optionKeyB]) {
183
      if (optionsSortMap[optionKeyA] < 0 && optionsSortMap[optionKeyB] < 0) {
184
        return Math.abs(optionsSortMap[optionKeyB]) - Math.abs(optionsSortMap[optionKeyA]);
185
      } else if (optionsSortMap[optionKeyA] < 0) {
186
        return -1;
187
      } else if (optionsSortMap[optionKeyB] < 0) {
188
        return 1;
189
      }
190

191
      return optionsSortMap[optionKeyA] - optionsSortMap[optionKeyB];
192
    } else if (optionsSortMap[optionKeyA]) {
193
      return optionsSortMap[optionKeyA];
194
    } else if (optionsSortMap[optionKeyB]) {
195
      return optionsSortMap[optionKeyB];
196
    }
197

198
    return 0;
199
  }
200

201
  var Default = {
202
    timeZone: '',
203
    format: false,
204
    dayViewHeaderFormat: 'MMMM YYYY',
205
    extraFormats: false,
206
    stepping: 1,
207
    minDate: false,
208
    maxDate: false,
209
    useCurrent: true,
210
    collapse: true,
211
    locale: moment.locale(),
212
    defaultDate: false,
213
    disabledDates: false,
214
    enabledDates: false,
215
    icons: {
216
      type: 'class',
217
      time: 'fa fa-clock-o',
218
      date: 'fa fa-calendar',
219
      up: 'fa fa-arrow-up',
220
      down: 'fa fa-arrow-down',
221
      previous: 'fa fa-chevron-left',
222
      next: 'fa fa-chevron-right',
223
      today: 'fa fa-calendar-check-o',
224
      clear: 'fa fa-trash',
225
      close: 'fa fa-times'
226
    },
227
    tooltips: {
228
      today: 'Go to today',
229
      clear: 'Clear selection',
230
      close: 'Close the picker',
231
      selectMonth: 'Select Month',
232
      prevMonth: 'Previous Month',
233
      nextMonth: 'Next Month',
234
      selectYear: 'Select Year',
235
      prevYear: 'Previous Year',
236
      nextYear: 'Next Year',
237
      selectDecade: 'Select Decade',
238
      prevDecade: 'Previous Decade',
239
      nextDecade: 'Next Decade',
240
      prevCentury: 'Previous Century',
241
      nextCentury: 'Next Century',
242
      pickHour: 'Pick Hour',
243
      incrementHour: 'Increment Hour',
244
      decrementHour: 'Decrement Hour',
245
      pickMinute: 'Pick Minute',
246
      incrementMinute: 'Increment Minute',
247
      decrementMinute: 'Decrement Minute',
248
      pickSecond: 'Pick Second',
249
      incrementSecond: 'Increment Second',
250
      decrementSecond: 'Decrement Second',
251
      togglePeriod: 'Toggle Period',
252
      selectTime: 'Select Time',
253
      selectDate: 'Select Date'
254
    },
255
    useStrict: false,
256
    sideBySide: false,
257
    daysOfWeekDisabled: false,
258
    calendarWeeks: false,
259
    viewMode: 'days',
260
    toolbarPlacement: 'default',
261
    buttons: {
262
      showToday: false,
263
      showClear: false,
264
      showClose: false
265
    },
266
    widgetPositioning: {
267
      horizontal: 'auto',
268
      vertical: 'auto'
269
    },
270
    widgetParent: null,
271
    readonly: false,
272
    ignoreReadonly: false,
273
    keepOpen: false,
274
    focusOnShow: true,
275
    inline: false,
276
    keepInvalid: false,
277
    keyBinds: {
278
      up: function up() {
279
        if (!this.widget) {
280
          return false;
281
        }
282

283
        var d = this._dates[0] || this.getMoment();
284

285
        if (this.widget.find('.datepicker').is(':visible')) {
286
          this.date(d.clone().subtract(7, 'd'));
287
        } else {
288
          this.date(d.clone().add(this.stepping(), 'm'));
289
        }
290

291
        return true;
292
      },
293
      down: function down() {
294
        if (!this.widget) {
295
          this.show();
296
          return false;
297
        }
298

299
        var d = this._dates[0] || this.getMoment();
300

301
        if (this.widget.find('.datepicker').is(':visible')) {
302
          this.date(d.clone().add(7, 'd'));
303
        } else {
304
          this.date(d.clone().subtract(this.stepping(), 'm'));
305
        }
306

307
        return true;
308
      },
309
      'control up': function controlUp() {
310
        if (!this.widget) {
311
          return false;
312
        }
313

314
        var d = this._dates[0] || this.getMoment();
315

316
        if (this.widget.find('.datepicker').is(':visible')) {
317
          this.date(d.clone().subtract(1, 'y'));
318
        } else {
319
          this.date(d.clone().add(1, 'h'));
320
        }
321

322
        return true;
323
      },
324
      'control down': function controlDown() {
325
        if (!this.widget) {
326
          return false;
327
        }
328

329
        var d = this._dates[0] || this.getMoment();
330

331
        if (this.widget.find('.datepicker').is(':visible')) {
332
          this.date(d.clone().add(1, 'y'));
333
        } else {
334
          this.date(d.clone().subtract(1, 'h'));
335
        }
336

337
        return true;
338
      },
339
      left: function left() {
340
        if (!this.widget) {
341
          return false;
342
        }
343

344
        var d = this._dates[0] || this.getMoment();
345

346
        if (this.widget.find('.datepicker').is(':visible')) {
347
          this.date(d.clone().subtract(1, 'd'));
348
        }
349

350
        return true;
351
      },
352
      right: function right() {
353
        if (!this.widget) {
354
          return false;
355
        }
356

357
        var d = this._dates[0] || this.getMoment();
358

359
        if (this.widget.find('.datepicker').is(':visible')) {
360
          this.date(d.clone().add(1, 'd'));
361
        }
362

363
        return true;
364
      },
365
      pageUp: function pageUp() {
366
        if (!this.widget) {
367
          return false;
368
        }
369

370
        var d = this._dates[0] || this.getMoment();
371

372
        if (this.widget.find('.datepicker').is(':visible')) {
373
          this.date(d.clone().subtract(1, 'M'));
374
        }
375

376
        return true;
377
      },
378
      pageDown: function pageDown() {
379
        if (!this.widget) {
380
          return false;
381
        }
382

383
        var d = this._dates[0] || this.getMoment();
384

385
        if (this.widget.find('.datepicker').is(':visible')) {
386
          this.date(d.clone().add(1, 'M'));
387
        }
388

389
        return true;
390
      },
391
      enter: function enter() {
392
        if (!this.widget) {
393
          return false;
394
        }
395

396
        this.hide();
397
        return true;
398
      },
399
      escape: function escape() {
400
        if (!this.widget) {
401
          return false;
402
        }
403

404
        this.hide();
405
        return true;
406
      },
407
      'control space': function controlSpace() {
408
        if (!this.widget) {
409
          return false;
410
        }
411

412
        if (this.widget.find('.timepicker').is(':visible')) {
413
          this.widget.find('.btn[data-action="togglePeriod"]').click();
414
        }
415

416
        return true;
417
      },
418
      t: function t() {
419
        if (!this.widget) {
420
          return false;
421
        }
422

423
        this.date(this.getMoment());
424
        return true;
425
      },
426
      'delete': function _delete() {
427
        if (!this.widget) {
428
          return false;
429
        }
430

431
        this.clear();
432
        return true;
433
      }
434
    },
435
    debug: false,
436
    allowInputToggle: false,
437
    disabledTimeIntervals: false,
438
    disabledHours: false,
439
    enabledHours: false,
440
    viewDate: false,
441
    allowMultidate: false,
442
    multidateSeparator: ', ',
443
    updateOnlyThroughDateOption: false,
444
    promptTimeOnDateChange: false,
445
    promptTimeOnDateChangeTransitionDelay: 200
446
  }; // ReSharper restore InconsistentNaming
447
  // ReSharper disable once DeclarationHides
448
  // ReSharper disable once InconsistentNaming
449

450
  var DateTimePicker = /*#__PURE__*/function () {
451
    /** @namespace eData.dateOptions */
452

453
    /** @namespace moment.tz */
454
    function DateTimePicker(element, options) {
455
      this._options = this._getOptions(options);
456
      this._element = element;
457
      this._dates = [];
458
      this._datesFormatted = [];
459
      this._viewDate = null;
460
      this.unset = true;
461
      this.component = false;
462
      this.widget = false;
463
      this.use24Hours = null;
464
      this.actualFormat = null;
465
      this.parseFormats = null;
466
      this.currentViewMode = null;
467
      this.MinViewModeNumber = 0;
468
      this.isInitFormatting = false;
469
      this.isInit = false;
470
      this.isDateUpdateThroughDateOptionFromClientCode = false;
471
      this.hasInitDate = false;
472
      this.initDate = void 0;
473
      this._notifyChangeEventContext = void 0;
474
      this._currentPromptTimeTimeout = null;
475

476
      this._int();
477
    }
478
    /**
479
     * @return {string}
480
     */
481

482

483
    var _proto = DateTimePicker.prototype;
484

485
    //private
486
    _proto._int = function _int() {
487
      this.isInit = true;
488

489
      var targetInput = this._element.data('target-input');
490

491
      if (this._element.is('input')) {
492
        this.input = this._element;
493
      } else if (targetInput !== undefined) {
494
        if (targetInput === 'nearest') {
495
          this.input = this._element.find('input');
496
        } else {
497
          this.input = $(targetInput);
498
        }
499
      }
500

501
      this._dates = [];
502
      this._dates[0] = this.getMoment();
503
      this._viewDate = this.getMoment().clone();
504
      $.extend(true, this._options, this._dataToOptions());
505
      this.hasInitDate = false;
506
      this.initDate = void 0;
507
      this.options(this._options);
508
      this.isInitFormatting = true;
509

510
      this._initFormatting();
511

512
      this.isInitFormatting = false;
513

514
      if (this.input !== undefined && this.input.is('input') && this.input.val().trim().length !== 0) {
515
        this._setValue(this._parseInputDate(this.input.val().trim()), 0);
516
      } else if (this._options.defaultDate && this.input !== undefined && this.input.attr('placeholder') === undefined) {
517
        this._setValue(this._options.defaultDate, 0);
518
      }
519

520
      if (this.hasInitDate) {
521
        this.date(this.initDate);
522
      }
523

524
      if (this._options.inline) {
525
        this.show();
526
      }
527

528
      this.isInit = false;
529
    };
530

531
    _proto._update = function _update() {
532
      if (!this.widget) {
533
        return;
534
      }
535

536
      this._fillDate();
537

538
      this._fillTime();
539
    };
540

541
    _proto._setValue = function _setValue(targetMoment, index) {
542
      var noIndex = typeof index === 'undefined',
543
          isClear = !targetMoment && noIndex,
544
          isDateUpdateThroughDateOptionFromClientCode = this.isDateUpdateThroughDateOptionFromClientCode,
545
          isNotAllowedProgrammaticUpdate = !this.isInit && this._options.updateOnlyThroughDateOption && !isDateUpdateThroughDateOptionFromClientCode;
546
      var outpValue = '',
547
          isInvalid = false,
548
          oldDate = this.unset ? null : this._dates[index];
549

550
      if (!oldDate && !this.unset && noIndex && isClear) {
551
        oldDate = this._dates[this._dates.length - 1];
552
      } // case of calling setValue(null or false)
553

554

555
      if (!targetMoment) {
556
        if (isNotAllowedProgrammaticUpdate) {
557
          this._notifyEvent({
558
            type: DateTimePicker.Event.CHANGE,
559
            date: targetMoment,
560
            oldDate: oldDate,
561
            isClear: isClear,
562
            isInvalid: isInvalid,
563
            isDateUpdateThroughDateOptionFromClientCode: isDateUpdateThroughDateOptionFromClientCode,
564
            isInit: this.isInit
565
          });
566

567
          return;
568
        }
569

570
        if (!this._options.allowMultidate || this._dates.length === 1 || isClear) {
571
          this.unset = true;
572
          this._dates = [];
573
          this._datesFormatted = [];
574
        } else {
575
          outpValue = "" + this._element.data('date') + this._options.multidateSeparator;
576
          outpValue = oldDate && outpValue.replace("" + oldDate.format(this.actualFormat) + this._options.multidateSeparator, '').replace("" + this._options.multidateSeparator + this._options.multidateSeparator, '').replace(new RegExp(escapeRegExp(this._options.multidateSeparator) + "\\s*$"), '') || '';
577

578
          this._dates.splice(index, 1);
579

580
          this._datesFormatted.splice(index, 1);
581
        }
582

583
        outpValue = trim(outpValue);
584

585
        if (this.input !== undefined) {
586
          this.input.val(outpValue);
587
          this.input.trigger('input');
588
        }
589

590
        this._element.data('date', outpValue);
591

592
        this._notifyEvent({
593
          type: DateTimePicker.Event.CHANGE,
594
          date: false,
595
          oldDate: oldDate,
596
          isClear: isClear,
597
          isInvalid: isInvalid,
598
          isDateUpdateThroughDateOptionFromClientCode: isDateUpdateThroughDateOptionFromClientCode,
599
          isInit: this.isInit
600
        });
601

602
        this._update();
603

604
        return;
605
      }
606

607
      targetMoment = targetMoment.clone().locale(this._options.locale);
608

609
      if (this._hasTimeZone()) {
610
        targetMoment.tz(this._options.timeZone);
611
      }
612

613
      if (this._options.stepping !== 1) {
614
        targetMoment.minutes(Math.round(targetMoment.minutes() / this._options.stepping) * this._options.stepping).seconds(0);
615
      }
616

617
      if (this._isValid(targetMoment)) {
618
        if (isNotAllowedProgrammaticUpdate) {
619
          this._notifyEvent({
620
            type: DateTimePicker.Event.CHANGE,
621
            date: targetMoment.clone(),
622
            oldDate: oldDate,
623
            isClear: isClear,
624
            isInvalid: isInvalid,
625
            isDateUpdateThroughDateOptionFromClientCode: isDateUpdateThroughDateOptionFromClientCode,
626
            isInit: this.isInit
627
          });
628

629
          return;
630
        }
631

632
        this._dates[index] = targetMoment;
633
        this._datesFormatted[index] = targetMoment.format('YYYY-MM-DD');
634
        this._viewDate = targetMoment.clone();
635

636
        if (this._options.allowMultidate && this._dates.length > 1) {
637
          for (var i = 0; i < this._dates.length; i++) {
638
            outpValue += "" + this._dates[i].format(this.actualFormat) + this._options.multidateSeparator;
639
          }
640

641
          outpValue = outpValue.replace(new RegExp(this._options.multidateSeparator + "\\s*$"), '');
642
        } else {
643
          outpValue = this._dates[index].format(this.actualFormat);
644
        }
645

646
        outpValue = trim(outpValue);
647

648
        if (this.input !== undefined) {
649
          this.input.val(outpValue);
650
          this.input.trigger('input');
651
        }
652

653
        this._element.data('date', outpValue);
654

655
        this.unset = false;
656

657
        this._update();
658

659
        this._notifyEvent({
660
          type: DateTimePicker.Event.CHANGE,
661
          date: this._dates[index].clone(),
662
          oldDate: oldDate,
663
          isClear: isClear,
664
          isInvalid: isInvalid,
665
          isDateUpdateThroughDateOptionFromClientCode: isDateUpdateThroughDateOptionFromClientCode,
666
          isInit: this.isInit
667
        });
668
      } else {
669
        isInvalid = true;
670

671
        if (!this._options.keepInvalid) {
672
          if (this.input !== undefined) {
673
            this.input.val("" + (this.unset ? '' : this._dates[index].format(this.actualFormat)));
674
            this.input.trigger('input');
675
          }
676
        } else {
677
          this._notifyEvent({
678
            type: DateTimePicker.Event.CHANGE,
679
            date: targetMoment,
680
            oldDate: oldDate,
681
            isClear: isClear,
682
            isInvalid: isInvalid,
683
            isDateUpdateThroughDateOptionFromClientCode: isDateUpdateThroughDateOptionFromClientCode,
684
            isInit: this.isInit
685
          });
686
        }
687

688
        this._notifyEvent({
689
          type: DateTimePicker.Event.ERROR,
690
          date: targetMoment,
691
          oldDate: oldDate
692
        });
693
      }
694
    };
695

696
    _proto._change = function _change(e) {
697
      var val = $(e.target).val().trim(),
698
          parsedDate = val ? this._parseInputDate(val) : null;
699

700
      this._setValue(parsedDate, 0);
701

702
      e.stopImmediatePropagation();
703
      return false;
704
    } //noinspection JSMethodCanBeStatic
705
    ;
706

707
    _proto._getOptions = function _getOptions(options) {
708
      options = $.extend(true, {}, Default, options && options.icons && options.icons.type === 'feather' ? {
709
        icons: defaultFeatherIcons
710
      } : {}, options);
711
      return options;
712
    };
713

714
    _proto._hasTimeZone = function _hasTimeZone() {
715
      return moment.tz !== undefined && this._options.timeZone !== undefined && this._options.timeZone !== null && this._options.timeZone !== '';
716
    };
717

718
    _proto._isEnabled = function _isEnabled(granularity) {
719
      if (typeof granularity !== 'string' || granularity.length > 1) {
720
        throw new TypeError('isEnabled expects a single character string parameter');
721
      }
722

723
      switch (granularity) {
724
        case 'y':
725
          return this.actualFormat.indexOf('Y') !== -1;
726

727
        case 'M':
728
          return this.actualFormat.indexOf('M') !== -1;
729

730
        case 'd':
731
          return this.actualFormat.toLowerCase().indexOf('d') !== -1;
732

733
        case 'h':
734
        case 'H':
735
          return this.actualFormat.toLowerCase().indexOf('h') !== -1;
736

737
        case 'm':
738
          return this.actualFormat.indexOf('m') !== -1;
739

740
        case 's':
741
          return this.actualFormat.indexOf('s') !== -1;
742

743
        case 'a':
744
        case 'A':
745
          return this.actualFormat.toLowerCase().indexOf('a') !== -1;
746

747
        default:
748
          return false;
749
      }
750
    };
751

752
    _proto._hasTime = function _hasTime() {
753
      return this._isEnabled('h') || this._isEnabled('m') || this._isEnabled('s');
754
    };
755

756
    _proto._hasDate = function _hasDate() {
757
      return this._isEnabled('y') || this._isEnabled('M') || this._isEnabled('d');
758
    };
759

760
    _proto._dataToOptions = function _dataToOptions() {
761
      var eData = this._element.data();
762

763
      var dataOptions = {};
764

765
      if (eData.dateOptions && eData.dateOptions instanceof Object) {
766
        dataOptions = $.extend(true, dataOptions, eData.dateOptions);
767
      }
768

769
      $.each(this._options, function (key) {
770
        var attributeName = "date" + key.charAt(0).toUpperCase() + key.slice(1); //todo data api key
771

772
        if (eData[attributeName] !== undefined) {
773
          dataOptions[key] = eData[attributeName];
774
        } else {
775
          delete dataOptions[key];
776
        }
777
      });
778
      return dataOptions;
779
    };
780

781
    _proto._format = function _format() {
782
      return this._options.format || 'YYYY-MM-DD HH:mm';
783
    };
784

785
    _proto._areSameDates = function _areSameDates(a, b) {
786
      var format = this._format();
787

788
      return a && b && (a.isSame(b) || moment(a.format(format), format).isSame(moment(b.format(format), format)));
789
    };
790

791
    _proto._notifyEvent = function _notifyEvent(e) {
792
      if (e.type === DateTimePicker.Event.CHANGE) {
793
        this._notifyChangeEventContext = this._notifyChangeEventContext || 0;
794
        this._notifyChangeEventContext++;
795

796
        if (e.date && this._areSameDates(e.date, e.oldDate) || !e.isClear && !e.date && !e.oldDate || this._notifyChangeEventContext > 1) {
797
          this._notifyChangeEventContext = void 0;
798
          return;
799
        }
800

801
        this._handlePromptTimeIfNeeded(e);
802
      }
803

804
      this._element.trigger(e);
805

806
      this._notifyChangeEventContext = void 0;
807
    };
808

809
    _proto._handlePromptTimeIfNeeded = function _handlePromptTimeIfNeeded(e) {
810
      if (this._options.promptTimeOnDateChange) {
811
        if (!e.oldDate && this._options.useCurrent) {
812
          // First time ever. If useCurrent option is set to true (default), do nothing
813
          // because the first date is selected automatically.
814
          return;
815
        } else if (e.oldDate && e.date && (e.oldDate.format('YYYY-MM-DD') === e.date.format('YYYY-MM-DD') || e.oldDate.format('YYYY-MM-DD') !== e.date.format('YYYY-MM-DD') && e.oldDate.format('HH:mm:ss') !== e.date.format('HH:mm:ss'))) {
816
          // Date didn't change (time did) or date changed because time did.
817
          return;
818
        }
819

820
        var that = this;
821
        clearTimeout(this._currentPromptTimeTimeout);
822
        this._currentPromptTimeTimeout = setTimeout(function () {
823
          if (that.widget) {
824
            that.widget.find('[data-action="togglePicker"]').click();
825
          }
826
        }, this._options.promptTimeOnDateChangeTransitionDelay);
827
      }
828
    };
829

830
    _proto._viewUpdate = function _viewUpdate(e) {
831
      if (e === 'y') {
832
        e = 'YYYY';
833
      }
834

835
      this._notifyEvent({
836
        type: DateTimePicker.Event.UPDATE,
837
        change: e,
838
        viewDate: this._viewDate.clone()
839
      });
840
    };
841

842
    _proto._showMode = function _showMode(dir) {
843
      if (!this.widget) {
844
        return;
845
      }
846

847
      if (dir) {
848
        this.currentViewMode = Math.max(this.MinViewModeNumber, Math.min(3, this.currentViewMode + dir));
849
      }
850

851
      this.widget.find('.datepicker > div').hide().filter(".datepicker-" + DatePickerModes[this.currentViewMode].CLASS_NAME).show();
852
    };
853

854
    _proto._isInDisabledDates = function _isInDisabledDates(testDate) {
855
      return this._options.disabledDates[testDate.format('YYYY-MM-DD')] === true;
856
    };
857

858
    _proto._isInEnabledDates = function _isInEnabledDates(testDate) {
859
      return this._options.enabledDates[testDate.format('YYYY-MM-DD')] === true;
860
    };
861

862
    _proto._isInDisabledHours = function _isInDisabledHours(testDate) {
863
      return this._options.disabledHours[testDate.format('H')] === true;
864
    };
865

866
    _proto._isInEnabledHours = function _isInEnabledHours(testDate) {
867
      return this._options.enabledHours[testDate.format('H')] === true;
868
    };
869

870
    _proto._isValid = function _isValid(targetMoment, granularity) {
871
      if (!targetMoment || !targetMoment.isValid()) {
872
        return false;
873
      }
874

875
      if (this._options.disabledDates && granularity === 'd' && this._isInDisabledDates(targetMoment)) {
876
        return false;
877
      }
878

879
      if (this._options.enabledDates && granularity === 'd' && !this._isInEnabledDates(targetMoment)) {
880
        return false;
881
      }
882

883
      if (this._options.minDate && targetMoment.isBefore(this._options.minDate, granularity)) {
884
        return false;
885
      }
886

887
      if (this._options.maxDate && targetMoment.isAfter(this._options.maxDate, granularity)) {
888
        return false;
889
      }
890

891
      if (this._options.daysOfWeekDisabled && granularity === 'd' && this._options.daysOfWeekDisabled.indexOf(targetMoment.day()) !== -1) {
892
        return false;
893
      }
894

895
      if (this._options.disabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && this._isInDisabledHours(targetMoment)) {
896
        return false;
897
      }
898

899
      if (this._options.enabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && !this._isInEnabledHours(targetMoment)) {
900
        return false;
901
      }
902

903
      if (this._options.disabledTimeIntervals && (granularity === 'h' || granularity === 'm' || granularity === 's')) {
904
        var found = false;
905
        $.each(this._options.disabledTimeIntervals, function () {
906
          if (targetMoment.isBetween(this[0], this[1])) {
907
            found = true;
908
            return false;
909
          }
910
        });
911

912
        if (found) {
913
          return false;
914
        }
915
      }
916

917
      return true;
918
    };
919

920
    _proto._parseInputDate = function _parseInputDate(inputDate, _temp) {
921
      var _ref = _temp === void 0 ? {} : _temp,
922
          _ref$isPickerShow = _ref.isPickerShow,
923
          isPickerShow = _ref$isPickerShow === void 0 ? false : _ref$isPickerShow;
924

925
      if (this._options.parseInputDate === undefined || isPickerShow) {
926
        if (!moment.isMoment(inputDate)) {
927
          inputDate = this.getMoment(inputDate);
928
        }
929
      } else {
930
        inputDate = this._options.parseInputDate(inputDate);
931
      } //inputDate.locale(this.options.locale);
932

933

934
      return inputDate;
935
    };
936

937
    _proto._keydown = function _keydown(e) {
938
      var handler = null,
939
          index,
940
          index2,
941
          keyBindKeys,
942
          allModifiersPressed;
943
      var pressedKeys = [],
944
          pressedModifiers = {},
945
          currentKey = e.which,
946
          pressed = 'p';
947
      keyState[currentKey] = pressed;
948

949
      for (index in keyState) {
950
        if (keyState.hasOwnProperty(index) && keyState[index] === pressed) {
951
          pressedKeys.push(index);
952

953
          if (parseInt(index, 10) !== currentKey) {
954
            pressedModifiers[index] = true;
955
          }
956
        }
957
      }
958

959
      for (index in this._options.keyBinds) {
960
        if (this._options.keyBinds.hasOwnProperty(index) && typeof this._options.keyBinds[index] === 'function') {
961
          keyBindKeys = index.split(' ');
962

963
          if (keyBindKeys.length === pressedKeys.length && KeyMap[currentKey] === keyBindKeys[keyBindKeys.length - 1]) {
964
            allModifiersPressed = true;
965

966
            for (index2 = keyBindKeys.length - 2; index2 >= 0; index2--) {
967
              if (!(KeyMap[keyBindKeys[index2]] in pressedModifiers)) {
968
                allModifiersPressed = false;
969
                break;
970
              }
971
            }
972

973
            if (allModifiersPressed) {
974
              handler = this._options.keyBinds[index];
975
              break;
976
            }
977
          }
978
        }
979
      }
980

981
      if (handler) {
982
        if (handler.call(this)) {
983
          e.stopPropagation();
984
          e.preventDefault();
985
        }
986
      }
987
    } //noinspection JSMethodCanBeStatic,SpellCheckingInspection
988
    ;
989

990
    _proto._keyup = function _keyup(e) {
991
      keyState[e.which] = 'r';
992

993
      if (keyPressHandled[e.which]) {
994
        keyPressHandled[e.which] = false;
995
        e.stopPropagation();
996
        e.preventDefault();
997
      }
998
    };
999

1000
    _proto._indexGivenDates = function _indexGivenDates(givenDatesArray) {
1001
      // Store given enabledDates and disabledDates as keys.
1002
      // This way we can check their existence in O(1) time instead of looping through whole array.
1003
      // (for example: options.enabledDates['2014-02-27'] === true)
1004
      var givenDatesIndexed = {},
1005
          self = this;
1006
      $.each(givenDatesArray, function () {
1007
        var dDate = self._parseInputDate(this);
1008

1009
        if (dDate.isValid()) {
1010
          givenDatesIndexed[dDate.format('YYYY-MM-DD')] = true;
1011
        }
1012
      });
1013
      return Object.keys(givenDatesIndexed).length ? givenDatesIndexed : false;
1014
    };
1015

1016
    _proto._indexGivenHours = function _indexGivenHours(givenHoursArray) {
1017
      // Store given enabledHours and disabledHours as keys.
1018
      // This way we can check their existence in O(1) time instead of looping through whole array.
1019
      // (for example: options.enabledHours['2014-02-27'] === true)
1020
      var givenHoursIndexed = {};
1021
      $.each(givenHoursArray, function () {
1022
        givenHoursIndexed[this] = true;
1023
      });
1024
      return Object.keys(givenHoursIndexed).length ? givenHoursIndexed : false;
1025
    };
1026

1027
    _proto._initFormatting = function _initFormatting() {
1028
      var format = this._options.format || 'L LT',
1029
          self = this;
1030
      this.actualFormat = format.replace(/(\[[^\[]*])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) {
1031
        return (self.isInitFormatting && self._options.date === null ? self.getMoment() : self._dates[0]).localeData().longDateFormat(formatInput) || formatInput; //todo taking the first date should be ok
1032
      });
1033
      this.parseFormats = this._options.extraFormats ? this._options.extraFormats.slice() : [];
1034

1035
      if (this.parseFormats.indexOf(format) < 0 && this.parseFormats.indexOf(this.actualFormat) < 0) {
1036
        this.parseFormats.push(this.actualFormat);
1037
      }
1038

1039
      this.use24Hours = this.actualFormat.toLowerCase().indexOf('a') < 1 && this.actualFormat.replace(/\[.*?]/g, '').indexOf('h') < 1;
1040

1041
      if (this._isEnabled('y')) {
1042
        this.MinViewModeNumber = 2;
1043
      }
1044

1045
      if (this._isEnabled('M')) {
1046
        this.MinViewModeNumber = 1;
1047
      }
1048

1049
      if (this._isEnabled('d')) {
1050
        this.MinViewModeNumber = 0;
1051
      }
1052

1053
      this.currentViewMode = Math.max(this.MinViewModeNumber, this.currentViewMode);
1054

1055
      if (!this.unset) {
1056
        this._setValue(this._dates[0], 0);
1057
      }
1058
    };
1059

1060
    _proto._getLastPickedDate = function _getLastPickedDate() {
1061
      var lastPickedDate = this._dates[this._getLastPickedDateIndex()];
1062

1063
      if (!lastPickedDate && this._options.allowMultidate) {
1064
        lastPickedDate = moment(new Date());
1065
      }
1066

1067
      return lastPickedDate;
1068
    };
1069

1070
    _proto._getLastPickedDateIndex = function _getLastPickedDateIndex() {
1071
      return this._dates.length - 1;
1072
    } //public
1073
    ;
1074

1075
    _proto.getMoment = function getMoment(d) {
1076
      var returnMoment;
1077

1078
      if (d === undefined || d === null) {
1079
        // TODO: Should this use format?
1080
        returnMoment = moment().clone().locale(this._options.locale);
1081
      } else if (this._hasTimeZone()) {
1082
        // There is a string to parse and a default time zone
1083
        // parse with the tz function which takes a default time zone if it is not in the format string
1084
        returnMoment = moment.tz(d, this.parseFormats, this._options.locale, this._options.useStrict, this._options.timeZone);
1085
      } else {
1086
        returnMoment = moment(d, this.parseFormats, this._options.locale, this._options.useStrict);
1087
      }
1088

1089
      if (this._hasTimeZone()) {
1090
        returnMoment.tz(this._options.timeZone);
1091
      }
1092

1093
      return returnMoment;
1094
    };
1095

1096
    _proto.toggle = function toggle() {
1097
      return this.widget ? this.hide() : this.show();
1098
    };
1099

1100
    _proto.readonly = function readonly(_readonly) {
1101
      if (arguments.length === 0) {
1102
        return this._options.readonly;
1103
      }
1104

1105
      if (typeof _readonly !== 'boolean') {
1106
        throw new TypeError('readonly() expects a boolean parameter');
1107
      }
1108

1109
      this._options.readonly = _readonly;
1110

1111
      if (this.input !== undefined) {
1112
        this.input.prop('readonly', this._options.readonly);
1113
      }
1114

1115
      if (this.widget) {
1116
        this.hide();
1117
        this.show();
1118
      }
1119
    };
1120

1121
    _proto.ignoreReadonly = function ignoreReadonly(_ignoreReadonly) {
1122
      if (arguments.length === 0) {
1123
        return this._options.ignoreReadonly;
1124
      }
1125

1126
      if (typeof _ignoreReadonly !== 'boolean') {
1127
        throw new TypeError('ignoreReadonly() expects a boolean parameter');
1128
      }
1129

1130
      this._options.ignoreReadonly = _ignoreReadonly;
1131
    };
1132

1133
    _proto.options = function options(newOptions) {
1134
      if (arguments.length === 0) {
1135
        return $.extend(true, {}, this._options);
1136
      }
1137

1138
      if (!(newOptions instanceof Object)) {
1139
        throw new TypeError('options() this.options parameter should be an object');
1140
      }
1141

1142
      $.extend(true, this._options, newOptions);
1143
      var self = this,
1144
          optionsKeys = Object.keys(this._options).sort(optionsSortFn);
1145
      $.each(optionsKeys, function (i, key) {
1146
        var value = self._options[key];
1147

1148
        if (self[key] !== undefined) {
1149
          if (self.isInit && key === 'date') {
1150
            self.hasInitDate = true;
1151
            self.initDate = value;
1152
            return;
1153
          }
1154

1155
          self[key](value);
1156
        }
1157
      });
1158
    };
1159

1160
    _proto.date = function date(newDate, index) {
1161
      index = index || 0;
1162

1163
      if (arguments.length === 0) {
1164
        if (this.unset) {
1165
          return null;
1166
        }
1167

1168
        if (this._options.allowMultidate) {
1169
          return this._dates.join(this._options.multidateSeparator);
1170
        } else {
1171
          return this._dates[index].clone();
1172
        }
1173
      }
1174

1175
      if (newDate !== null && typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) {
1176
        throw new TypeError('date() parameter must be one of [null, string, moment or Date]');
1177
      }
1178

1179
      if (typeof newDate === 'string' && isValidDateTimeStr(newDate)) {
1180
        newDate = new Date(newDate);
1181
      }
1182

1183
      this._setValue(newDate === null ? null : this._parseInputDate(newDate), index);
1184
    };
1185

1186
    _proto.updateOnlyThroughDateOption = function updateOnlyThroughDateOption(_updateOnlyThroughDateOption) {
1187
      if (typeof _updateOnlyThroughDateOption !== 'boolean') {
1188
        throw new TypeError('updateOnlyThroughDateOption() expects a boolean parameter');
1189
      }
1190

1191
      this._options.updateOnlyThroughDateOption = _updateOnlyThroughDateOption;
1192
    };
1193

1194
    _proto.format = function format(newFormat) {
1195
      if (arguments.length === 0) {
1196
        return this._options.format;
1197
      }
1198

1199
      if (typeof newFormat !== 'string' && (typeof newFormat !== 'boolean' || newFormat !== false)) {
1200
        throw new TypeError("format() expects a string or boolean:false parameter " + newFormat);
1201
      }
1202

1203
      this._options.format = newFormat;
1204

1205
      if (this.actualFormat) {
1206
        this._initFormatting(); // reinitialize formatting
1207

1208
      }
1209
    };
1210

1211
    _proto.timeZone = function timeZone(newZone) {
1212
      if (arguments.length === 0) {
1213
        return this._options.timeZone;
1214
      }
1215

1216
      if (typeof newZone !== 'string') {
1217
        throw new TypeError('newZone() expects a string parameter');
1218
      }
1219

1220
      this._options.timeZone = newZone;
1221
    };
1222

1223
    _proto.dayViewHeaderFormat = function dayViewHeaderFormat(newFormat) {
1224
      if (arguments.length === 0) {
1225
        return this._options.dayViewHeaderFormat;
1226
      }
1227

1228
      if (typeof newFormat !== 'string') {
1229
        throw new TypeError('dayViewHeaderFormat() expects a string parameter');
1230
      }
1231

1232
      this._options.dayViewHeaderFormat = newFormat;
1233
    };
1234

1235
    _proto.extraFormats = function extraFormats(formats) {
1236
      if (arguments.length === 0) {
1237
        return this._options.extraFormats;
1238
      }
1239

1240
      if (formats !== false && !(formats instanceof Array)) {
1241
        throw new TypeError('extraFormats() expects an array or false parameter');
1242
      }
1243

1244
      this._options.extraFormats = formats;
1245

1246
      if (this.parseFormats) {
1247
        this._initFormatting(); // reinit formatting
1248

1249
      }
1250
    };
1251

1252
    _proto.disabledDates = function disabledDates(dates) {
1253
      if (arguments.length === 0) {
1254
        return this._options.disabledDates ? $.extend({}, this._options.disabledDates) : this._options.disabledDates;
1255
      }
1256

1257
      if (!dates) {
1258
        this._options.disabledDates = false;
1259

1260
        this._update();
1261

1262
        return true;
1263
      }
1264

1265
      if (!(dates instanceof Array)) {
1266
        throw new TypeError('disabledDates() expects an array parameter');
1267
      }
1268

1269
      this._options.disabledDates = this._indexGivenDates(dates);
1270
      this._options.enabledDates = false;
1271

1272
      this._update();
1273
    };
1274

1275
    _proto.enabledDates = function enabledDates(dates) {
1276
      if (arguments.length === 0) {
1277
        return this._options.enabledDates ? $.extend({}, this._options.enabledDates) : this._options.enabledDates;
1278
      }
1279

1280
      if (!dates) {
1281
        this._options.enabledDates = false;
1282

1283
        this._update();
1284

1285
        return true;
1286
      }
1287

1288
      if (!(dates instanceof Array)) {
1289
        throw new TypeError('enabledDates() expects an array parameter');
1290
      }
1291

1292
      this._options.enabledDates = this._indexGivenDates(dates);
1293
      this._options.disabledDates = false;
1294

1295
      this._update();
1296
    };
1297

1298
    _proto.daysOfWeekDisabled = function daysOfWeekDisabled(_daysOfWeekDisabled) {
1299
      if (arguments.length === 0) {
1300
        return this._options.daysOfWeekDisabled.splice(0);
1301
      }
1302

1303
      if (typeof _daysOfWeekDisabled === 'boolean' && !_daysOfWeekDisabled) {
1304
        this._options.daysOfWeekDisabled = false;
1305

1306
        this._update();
1307

1308
        return true;
1309
      }
1310

1311
      if (!(_daysOfWeekDisabled instanceof Array)) {
1312
        throw new TypeError('daysOfWeekDisabled() expects an array parameter');
1313
      }
1314

1315
      this._options.daysOfWeekDisabled = _daysOfWeekDisabled.reduce(function (previousValue, currentValue) {
1316
        currentValue = parseInt(currentValue, 10);
1317

1318
        if (currentValue > 6 || currentValue < 0 || isNaN(currentValue)) {
1319
          return previousValue;
1320
        }
1321

1322
        if (previousValue.indexOf(currentValue) === -1) {
1323
          previousValue.push(currentValue);
1324
        }
1325

1326
        return previousValue;
1327
      }, []).sort();
1328

1329
      if (this._options.useCurrent && !this._options.keepInvalid) {
1330
        for (var i = 0; i < this._dates.length; i++) {
1331
          var tries = 0;
1332

1333
          while (!this._isValid(this._dates[i], 'd')) {
1334
            this._dates[i].add(1, 'd');
1335

1336
            if (tries === 31) {
1337
              throw 'Tried 31 times to find a valid date';
1338
            }
1339

1340
            tries++;
1341
          }
1342

1343
          this._setValue(this._dates[i], i);
1344
        }
1345
      }
1346

1347
      this._update();
1348
    };
1349

1350
    _proto.maxDate = function maxDate(_maxDate) {
1351
      if (arguments.length === 0) {
1352
        return this._options.maxDate ? this._options.maxDate.clone() : this._options.maxDate;
1353
      }
1354

1355
      if (typeof _maxDate === 'boolean' && _maxDate === false) {
1356
        this._options.maxDate = false;
1357

1358
        this._update();
1359

1360
        return true;
1361
      }
1362

1363
      if (typeof _maxDate === 'string') {
1364
        if (_maxDate === 'now' || _maxDate === 'moment') {
1365
          _maxDate = this.getMoment();
1366
        }
1367
      }
1368

1369
      var parsedDate = this._parseInputDate(_maxDate);
1370

1371
      if (!parsedDate.isValid()) {
1372
        throw new TypeError("maxDate() Could not parse date parameter: " + _maxDate);
1373
      }
1374

1375
      if (this._options.minDate && parsedDate.isBefore(this._options.minDate)) {
1376
        throw new TypeError("maxDate() date parameter is before this.options.minDate: " + parsedDate.format(this.actualFormat));
1377
      }
1378

1379
      this._options.maxDate = parsedDate;
1380

1381
      for (var i = 0; i < this._dates.length; i++) {
1382
        if (this._options.useCurrent && !this._options.keepInvalid && this._dates[i].isAfter(_maxDate)) {
1383
          this._setValue(this._options.maxDate, i);
1384
        }
1385
      }
1386

1387
      if (this._viewDate.isAfter(parsedDate)) {
1388
        this._viewDate = parsedDate.clone().subtract(this._options.stepping, 'm');
1389
      }
1390

1391
      this._update();
1392
    };
1393

1394
    _proto.minDate = function minDate(_minDate) {
1395
      if (arguments.length === 0) {
1396
        return this._options.minDate ? this._options.minDate.clone() : this._options.minDate;
1397
      }
1398

1399
      if (typeof _minDate === 'boolean' && _minDate === false) {
1400
        this._options.minDate = false;
1401

1402
        this._update();
1403

1404
        return true;
1405
      }
1406

1407
      if (typeof _minDate === 'string') {
1408
        if (_minDate === 'now' || _minDate === 'moment') {
1409
          _minDate = this.getMoment();
1410
        }
1411
      }
1412

1413
      var parsedDate = this._parseInputDate(_minDate);
1414

1415
      if (!parsedDate.isValid()) {
1416
        throw new TypeError("minDate() Could not parse date parameter: " + _minDate);
1417
      }
1418

1419
      if (this._options.maxDate && parsedDate.isAfter(this._options.maxDate)) {
1420
        throw new TypeError("minDate() date parameter is after this.options.maxDate: " + parsedDate.format(this.actualFormat));
1421
      }
1422

1423
      this._options.minDate = parsedDate;
1424

1425
      for (var i = 0; i < this._dates.length; i++) {
1426
        if (this._options.useCurrent && !this._options.keepInvalid && this._dates[i].isBefore(_minDate)) {
1427
          this._setValue(this._options.minDate, i);
1428
        }
1429
      }
1430

1431
      if (this._viewDate.isBefore(parsedDate)) {
1432
        this._viewDate = parsedDate.clone().add(this._options.stepping, 'm');
1433
      }
1434

1435
      this._update();
1436
    };
1437

1438
    _proto.defaultDate = function defaultDate(_defaultDate) {
1439
      if (arguments.length === 0) {
1440
        return this._options.defaultDate ? this._options.defaultDate.clone() : this._options.defaultDate;
1441
      }
1442

1443
      if (!_defaultDate) {
1444
        this._options.defaultDate = false;
1445
        return true;
1446
      }
1447

1448
      if (typeof _defaultDate === 'string') {
1449
        if (_defaultDate === 'now' || _defaultDate === 'moment') {
1450
          _defaultDate = this.getMoment();
1451
        } else {
1452
          _defaultDate = this.getMoment(_defaultDate);
1453
        }
1454
      }
1455

1456
      var parsedDate = this._parseInputDate(_defaultDate);
1457

1458
      if (!parsedDate.isValid()) {
1459
        throw new TypeError("defaultDate() Could not parse date parameter: " + _defaultDate);
1460
      }
1461

1462
      if (!this._isValid(parsedDate)) {
1463
        throw new TypeError('defaultDate() date passed is invalid according to component setup validations');
1464
      }
1465

1466
      this._options.defaultDate = parsedDate;
1467

1468
      if (this._options.defaultDate && this._options.inline || this.input !== undefined && this.input.val().trim() === '') {
1469
        this._setValue(this._options.defaultDate, 0);
1470
      }
1471
    };
1472

1473
    _proto.locale = function locale(_locale) {
1474
      if (arguments.length === 0) {
1475
        return this._options.locale;
1476
      }
1477

1478
      if (!moment.localeData(_locale)) {
1479
        throw new TypeError("locale() locale " + _locale + " is not loaded from moment locales!");
1480
      }
1481

1482
      this._options.locale = _locale;
1483

1484
      for (var i = 0; i < this._dates.length; i++) {
1485
        this._dates[i].locale(this._options.locale);
1486
      }
1487

1488
      this._viewDate.locale(this._options.locale);
1489

1490
      if (this.actualFormat) {
1491
        this._initFormatting(); // reinitialize formatting
1492

1493
      }
1494

1495
      if (this.widget) {
1496
        this.hide();
1497
        this.show();
1498
      }
1499
    };
1500

1501
    _proto.stepping = function stepping(_stepping) {
1502
      if (arguments.length === 0) {
1503
        return this._options.stepping;
1504
      }
1505

1506
      _stepping = parseInt(_stepping, 10);
1507

1508
      if (isNaN(_stepping) || _stepping < 1) {
1509
        _stepping = 1;
1510
      }
1511

1512
      this._options.stepping = _stepping;
1513
    };
1514

1515
    _proto.useCurrent = function useCurrent(_useCurrent) {
1516
      var useCurrentOptions = ['year', 'month', 'day', 'hour', 'minute'];
1517

1518
      if (arguments.length === 0) {
1519
        return this._options.useCurrent;
1520
      }
1521

1522
      if (typeof _useCurrent !== 'boolean' && typeof _useCurrent !== 'string') {
1523
        throw new TypeError('useCurrent() expects a boolean or string parameter');
1524
      }
1525

1526
      if (typeof _useCurrent === 'string' && useCurrentOptions.indexOf(_useCurrent.toLowerCase()) === -1) {
1527
        throw new TypeError("useCurrent() expects a string parameter of " + useCurrentOptions.join(', '));
1528
      }
1529

1530
      this._options.useCurrent = _useCurrent;
1531
    };
1532

1533
    _proto.collapse = function collapse(_collapse) {
1534
      if (arguments.length === 0) {
1535
        return this._options.collapse;
1536
      }
1537

1538
      if (typeof _collapse !== 'boolean') {
1539
        throw new TypeError('collapse() expects a boolean parameter');
1540
      }
1541

1542
      if (this._options.collapse === _collapse) {
1543
        return true;
1544
      }
1545

1546
      this._options.collapse = _collapse;
1547

1548
      if (this.widget) {
1549
        this.hide();
1550
        this.show();
1551
      }
1552
    };
1553

1554
    _proto.icons = function icons(_icons) {
1555
      if (arguments.length === 0) {
1556
        return $.extend({}, this._options.icons);
1557
      }
1558

1559
      if (!(_icons instanceof Object)) {
1560
        throw new TypeError('icons() expects parameter to be an Object');
1561
      }
1562

1563
      $.extend(this._options.icons, _icons);
1564

1565
      if (this.widget) {
1566
        this.hide();
1567
        this.show();
1568
      }
1569
    };
1570

1571
    _proto.tooltips = function tooltips(_tooltips) {
1572
      if (arguments.length === 0) {
1573
        return $.extend({}, this._options.tooltips);
1574
      }
1575

1576
      if (!(_tooltips instanceof Object)) {
1577
        throw new TypeError('tooltips() expects parameter to be an Object');
1578
      }
1579

1580
      $.extend(this._options.tooltips, _tooltips);
1581

1582
      if (this.widget) {
1583
        this.hide();
1584
        this.show();
1585
      }
1586
    };
1587

1588
    _proto.useStrict = function useStrict(_useStrict) {
1589
      if (arguments.length === 0) {
1590
        return this._options.useStrict;
1591
      }
1592

1593
      if (typeof _useStrict !== 'boolean') {
1594
        throw new TypeError('useStrict() expects a boolean parameter');
1595
      }
1596

1597
      this._options.useStrict = _useStrict;
1598
    };
1599

1600
    _proto.sideBySide = function sideBySide(_sideBySide) {
1601
      if (arguments.length === 0) {
1602
        return this._options.sideBySide;
1603
      }
1604

1605
      if (typeof _sideBySide !== 'boolean') {
1606
        throw new TypeError('sideBySide() expects a boolean parameter');
1607
      }
1608

1609
      this._options.sideBySide = _sideBySide;
1610

1611
      if (this.widget) {
1612
        this.hide();
1613
        this.show();
1614
      }
1615
    };
1616

1617
    _proto.viewMode = function viewMode(_viewMode) {
1618
      if (arguments.length === 0) {
1619
        return this._options.viewMode;
1620
      }
1621

1622
      if (typeof _viewMode !== 'string') {
1623
        throw new TypeError('viewMode() expects a string parameter');
1624
      }
1625

1626
      if (DateTimePicker.ViewModes.indexOf(_viewMode) === -1) {
1627
        throw new TypeError("viewMode() parameter must be one of (" + DateTimePicker.ViewModes.join(', ') + ") value");
1628
      }
1629

1630
      this._options.viewMode = _viewMode;
1631
      this.currentViewMode = Math.max(DateTimePicker.ViewModes.indexOf(_viewMode) - 1, this.MinViewModeNumber);
1632

1633
      this._showMode();
1634
    };
1635

1636
    _proto.calendarWeeks = function calendarWeeks(_calendarWeeks) {
1637
      if (arguments.length === 0) {
1638
        return this._options.calendarWeeks;
1639
      }
1640

1641
      if (typeof _calendarWeeks !== 'boolean') {
1642
        throw new TypeError('calendarWeeks() expects parameter to be a boolean value');
1643
      }
1644

1645
      this._options.calendarWeeks = _calendarWeeks;
1646

1647
      this._update();
1648
    };
1649

1650
    _proto.buttons = function buttons(_buttons) {
1651
      if (arguments.length === 0) {
1652
        return $.extend({}, this._options.buttons);
1653
      }
1654

1655
      if (!(_buttons instanceof Object)) {
1656
        throw new TypeError('buttons() expects parameter to be an Object');
1657
      }
1658

1659
      $.extend(this._options.buttons, _buttons);
1660

1661
      if (typeof this._options.buttons.showToday !== 'boolean') {
1662
        throw new TypeError('buttons.showToday expects a boolean parameter');
1663
      }
1664

1665
      if (typeof this._options.buttons.showClear !== 'boolean') {
1666
        throw new TypeError('buttons.showClear expects a boolean parameter');
1667
      }
1668

1669
      if (typeof this._options.buttons.showClose !== 'boolean') {
1670
        throw new TypeError('buttons.showClose expects a boolean parameter');
1671
      }
1672

1673
      if (this.widget) {
1674
        this.hide();
1675
        this.show();
1676
      }
1677
    };
1678

1679
    _proto.keepOpen = function keepOpen(_keepOpen) {
1680
      if (arguments.length === 0) {
1681
        return this._options.keepOpen;
1682
      }
1683

1684
      if (typeof _keepOpen !== 'boolean') {
1685
        throw new TypeError('keepOpen() expects a boolean parameter');
1686
      }
1687

1688
      this._options.keepOpen = _keepOpen;
1689
    };
1690

1691
    _proto.focusOnShow = function focusOnShow(_focusOnShow) {
1692
      if (arguments.length === 0) {
1693
        return this._options.focusOnShow;
1694
      }
1695

1696
      if (typeof _focusOnShow !== 'boolean') {
1697
        throw new TypeError('focusOnShow() expects a boolean parameter');
1698
      }
1699

1700
      this._options.focusOnShow = _focusOnShow;
1701
    };
1702

1703
    _proto.inline = function inline(_inline) {
1704
      if (arguments.length === 0) {
1705
        return this._options.inline;
1706
      }
1707

1708
      if (typeof _inline !== 'boolean') {
1709
        throw new TypeError('inline() expects a boolean parameter');
1710
      }
1711

1712
      this._options.inline = _inline;
1713
    };
1714

1715
    _proto.clear = function clear() {
1716
      this._setValue(null); //todo
1717

1718
    };
1719

1720
    _proto.keyBinds = function keyBinds(_keyBinds) {
1721
      if (arguments.length === 0) {
1722
        return this._options.keyBinds;
1723
      }
1724

1725
      this._options.keyBinds = _keyBinds;
1726
    };
1727

1728
    _proto.debug = function debug(_debug) {
1729
      if (typeof _debug !== 'boolean') {
1730
        throw new TypeError('debug() expects a boolean parameter');
1731
      }
1732

1733
      this._options.debug = _debug;
1734
    };
1735

1736
    _proto.allowInputToggle = function allowInputToggle(_allowInputToggle) {
1737
      if (arguments.length === 0) {
1738
        return this._options.allowInputToggle;
1739
      }
1740

1741
      if (typeof _allowInputToggle !== 'boolean') {
1742
        throw new TypeError('allowInputToggle() expects a boolean parameter');
1743
      }
1744

1745
      this._options.allowInputToggle = _allowInputToggle;
1746
    };
1747

1748
    _proto.keepInvalid = function keepInvalid(_keepInvalid) {
1749
      if (arguments.length === 0) {
1750
        return this._options.keepInvalid;
1751
      }
1752

1753
      if (typeof _keepInvalid !== 'boolean') {
1754
        throw new TypeError('keepInvalid() expects a boolean parameter');
1755
      }
1756

1757
      this._options.keepInvalid = _keepInvalid;
1758
    };
1759

1760
    _proto.datepickerInput = function datepickerInput(_datepickerInput) {
1761
      if (arguments.length === 0) {
1762
        return this._options.datepickerInput;
1763
      }
1764

1765
      if (typeof _datepickerInput !== 'string') {
1766
        throw new TypeError('datepickerInput() expects a string parameter');
1767
      }
1768

1769
      this._options.datepickerInput = _datepickerInput;
1770
    };
1771

1772
    _proto.parseInputDate = function parseInputDate(_parseInputDate2) {
1773
      if (arguments.length === 0) {
1774
        return this._options.parseInputDate;
1775
      }
1776

1777
      if (typeof _parseInputDate2 !== 'function') {
1778
        throw new TypeError('parseInputDate() should be as function');
1779
      }
1780

1781
      this._options.parseInputDate = _parseInputDate2;
1782
    };
1783

1784
    _proto.disabledTimeIntervals = function disabledTimeIntervals(_disabledTimeIntervals) {
1785
      if (arguments.length === 0) {
1786
        return this._options.disabledTimeIntervals ? $.extend({}, this._options.disabledTimeIntervals) : this._options.disabledTimeIntervals;
1787
      }
1788

1789
      if (!_disabledTimeIntervals) {
1790
        this._options.disabledTimeIntervals = false;
1791

1792
        this._update();
1793

1794
        return true;
1795
      }
1796

1797
      if (!(_disabledTimeIntervals instanceof Array)) {
1798
        throw new TypeError('disabledTimeIntervals() expects an array parameter');
1799
      }
1800

1801
      this._options.disabledTimeIntervals = _disabledTimeIntervals;
1802

1803
      this._update();
1804
    };
1805

1806
    _proto.disabledHours = function disabledHours(hours) {
1807
      if (arguments.length === 0) {
1808
        return this._options.disabledHours ? $.extend({}, this._options.disabledHours) : this._options.disabledHours;
1809
      }
1810

1811
      if (!hours) {
1812
        this._options.disabledHours = false;
1813

1814
        this._update();
1815

1816
        return true;
1817
      }
1818

1819
      if (!(hours instanceof Array)) {
1820
        throw new TypeError('disabledHours() expects an array parameter');
1821
      }
1822

1823
      this._options.disabledHours = this._indexGivenHours(hours);
1824
      this._options.enabledHours = false;
1825

1826
      if (this._options.useCurrent && !this._options.keepInvalid) {
1827
        for (var i = 0; i < this._dates.length; i++) {
1828
          var tries = 0;
1829

1830
          while (!this._isValid(this._dates[i], 'h')) {
1831
            this._dates[i].add(1, 'h');
1832

1833
            if (tries === 24) {
1834
              throw 'Tried 24 times to find a valid date';
1835
            }
1836

1837
            tries++;
1838
          }
1839

1840
          this._setValue(this._dates[i], i);
1841
        }
1842
      }
1843

1844
      this._update();
1845
    };
1846

1847
    _proto.enabledHours = function enabledHours(hours) {
1848
      if (arguments.length === 0) {
1849
        return this._options.enabledHours ? $.extend({}, this._options.enabledHours) : this._options.enabledHours;
1850
      }
1851

1852
      if (!hours) {
1853
        this._options.enabledHours = false;
1854

1855
        this._update();
1856

1857
        return true;
1858
      }
1859

1860
      if (!(hours instanceof Array)) {
1861
        throw new TypeError('enabledHours() expects an array parameter');
1862
      }
1863

1864
      this._options.enabledHours = this._indexGivenHours(hours);
1865
      this._options.disabledHours = false;
1866

1867
      if (this._options.useCurrent && !this._options.keepInvalid) {
1868
        for (var i = 0; i < this._dates.length; i++) {
1869
          var tries = 0;
1870

1871
          while (!this._isValid(this._dates[i], 'h')) {
1872
            this._dates[i].add(1, 'h');
1873

1874
            if (tries === 24) {
1875
              throw 'Tried 24 times to find a valid date';
1876
            }
1877

1878
            tries++;
1879
          }
1880

1881
          this._setValue(this._dates[i], i);
1882
        }
1883
      }
1884

1885
      this._update();
1886
    };
1887

1888
    _proto.viewDate = function viewDate(newDate) {
1889
      if (arguments.length === 0) {
1890
        return this._viewDate.clone();
1891
      }
1892

1893
      if (!newDate) {
1894
        this._viewDate = (this._dates[0] || this.getMoment()).clone();
1895
        return true;
1896
      }
1897

1898
      if (typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) {
1899
        throw new TypeError('viewDate() parameter must be one of [string, moment or Date]');
1900
      }
1901

1902
      this._viewDate = this._parseInputDate(newDate);
1903

1904
      this._update();
1905

1906
      this._viewUpdate(DatePickerModes[this.currentViewMode] && DatePickerModes[this.currentViewMode].NAV_FUNCTION);
1907
    };
1908

1909
    _proto._fillDate = function _fillDate() {};
1910

1911
    _proto._useFeatherIcons = function _useFeatherIcons() {
1912
      return this._options.icons.type === 'feather';
1913
    };
1914

1915
    _proto.allowMultidate = function allowMultidate(_allowMultidate) {
1916
      if (typeof _allowMultidate !== 'boolean') {
1917
        throw new TypeError('allowMultidate() expects a boolean parameter');
1918
      }
1919

1920
      this._options.allowMultidate = _allowMultidate;
1921
    };
1922

1923
    _proto.multidateSeparator = function multidateSeparator(_multidateSeparator) {
1924
      if (arguments.length === 0) {
1925
        return this._options.multidateSeparator;
1926
      }
1927

1928
      if (typeof _multidateSeparator !== 'string') {
1929
        throw new TypeError('multidateSeparator expects a string parameter');
1930
      }
1931

1932
      this._options.multidateSeparator = _multidateSeparator;
1933
    };
1934

1935
    _createClass(DateTimePicker, null, [{
1936
      key: "NAME",
1937
      get: function get() {
1938
        return NAME;
1939
      }
1940
      /**
1941
       * @return {string}
1942
       */
1943

1944
    }, {
1945
      key: "DATA_KEY",
1946
      get: function get() {
1947
        return DATA_KEY;
1948
      }
1949
      /**
1950
       * @return {string}
1951
       */
1952

1953
    }, {
1954
      key: "EVENT_KEY",
1955
      get: function get() {
1956
        return EVENT_KEY;
1957
      }
1958
      /**
1959
       * @return {string}
1960
       */
1961

1962
    }, {
1963
      key: "DATA_API_KEY",
1964
      get: function get() {
1965
        return DATA_API_KEY;
1966
      }
1967
    }, {
1968
      key: "DatePickerModes",
1969
      get: function get() {
1970
        return DatePickerModes;
1971
      }
1972
    }, {
1973
      key: "ViewModes",
1974
      get: function get() {
1975
        return ViewModes;
1976
      }
1977
    }, {
1978
      key: "Event",
1979
      get: function get() {
1980
        return Event;
1981
      }
1982
    }, {
1983
      key: "Selector",
1984
      get: function get() {
1985
        return Selector;
1986
      }
1987
    }, {
1988
      key: "Default",
1989
      get: function get() {
1990
        return Default;
1991
      },
1992
      set: function set(value) {
1993
        Default = value;
1994
      }
1995
    }, {
1996
      key: "ClassName",
1997
      get: function get() {
1998
        return ClassName;
1999
      }
2000
    }]);
2001

2002
    return DateTimePicker;
2003
  }();
2004

2005
  return DateTimePicker;
2006
}(jQuery, moment); //noinspection JSUnusedGlobalSymbols
2007

2008
/* global DateTimePicker */
2009

2010
/* global feather */
2011

2012

2013
var TempusDominusBootstrap4 = function ($) {
2014
  // eslint-disable-line no-unused-vars
2015
  // ReSharper disable once InconsistentNaming
2016
  var JQUERY_NO_CONFLICT = $.fn[DateTimePicker.NAME],
2017
      verticalModes = ['top', 'bottom', 'auto'],
2018
      horizontalModes = ['left', 'right', 'auto'],
2019
      toolbarPlacements = ['default', 'top', 'bottom'],
2020
      getSelectorFromElement = function getSelectorFromElement($element) {
2021
    var selector = $element.data('target'),
2022
        $selector;
2023

2024
    if (!selector) {
2025
      selector = $element.attr('href') || '';
2026
      selector = /^#[a-z]/i.test(selector) ? selector : null;
2027
    }
2028

2029
    $selector = $(selector);
2030

2031
    if ($selector.length === 0) {
2032
      return $element;
2033
    }
2034

2035
    if (!$selector.data(DateTimePicker.DATA_KEY)) {
2036
      $.extend({}, $selector.data(), $(this).data());
2037
    }
2038

2039
    return $selector;
2040
  }; // ReSharper disable once InconsistentNaming
2041

2042

2043
  var TempusDominusBootstrap4 = /*#__PURE__*/function (_DateTimePicker) {
2044
    _inheritsLoose(TempusDominusBootstrap4, _DateTimePicker);
2045

2046
    function TempusDominusBootstrap4(element, options) {
2047
      var _this;
2048

2049
      _this = _DateTimePicker.call(this, element, options) || this;
2050

2051
      _this._init();
2052

2053
      return _this;
2054
    }
2055

2056
    var _proto2 = TempusDominusBootstrap4.prototype;
2057

2058
    _proto2._init = function _init() {
2059
      if (this._element.hasClass('input-group')) {
2060
        var datepickerButton = this._element.find('.datepickerbutton');
2061

2062
        if (datepickerButton.length === 0) {
2063
          this.component = this._element.find('[data-toggle="datetimepicker"]');
2064
        } else {
2065
          this.component = datepickerButton;
2066
        }
2067
      }
2068
    };
2069

2070
    _proto2._iconTag = function _iconTag(iconName) {
2071
      if (typeof feather !== 'undefined' && this._useFeatherIcons() && feather.icons[iconName]) {
2072
        return $('<span>').html(feather.icons[iconName].toSvg());
2073
      } else {
2074
        return $('<span>').addClass(iconName);
2075
      }
2076
    };
2077

2078
    _proto2._getDatePickerTemplate = function _getDatePickerTemplate() {
2079
      var headTemplate = $('<thead>').append($('<tr>').append($('<th>').addClass('prev').attr('data-action', 'previous').append(this._iconTag(this._options.icons.previous))).append($('<th>').addClass('picker-switch').attr('data-action', 'pickerSwitch').attr('colspan', "" + (this._options.calendarWeeks ? '6' : '5'))).append($('<th>').addClass('next').attr('data-action', 'next').append(this._iconTag(this._options.icons.next)))),
2080
          contTemplate = $('<tbody>').append($('<tr>').append($('<td>').attr('colspan', "" + (this._options.calendarWeeks ? '8' : '7'))));
2081
      return [$('<div>').addClass('datepicker-days').append($('<table>').addClass('table table-sm').append(headTemplate).append($('<tbody>'))), $('<div>').addClass('datepicker-months').append($('<table>').addClass('table-condensed').append(headTemplate.clone()).append(contTemplate.clone())), $('<div>').addClass('datepicker-years').append($('<table>').addClass('table-condensed').append(headTemplate.clone()).append(contTemplate.clone())), $('<div>').addClass('datepicker-decades').append($('<table>').addClass('table-condensed').append(headTemplate.clone()).append(contTemplate.clone()))];
2082
    };
2083

2084
    _proto2._getTimePickerMainTemplate = function _getTimePickerMainTemplate() {
2085
      var topRow = $('<tr>'),
2086
          middleRow = $('<tr>'),
2087
          bottomRow = $('<tr>');
2088

2089
      if (this._isEnabled('h')) {
2090
        topRow.append($('<td>').append($('<a>').attr({
2091
          href: '#',
2092
          tabindex: '-1',
2093
          'title': this._options.tooltips.incrementHour
2094
        }).addClass('btn').attr('data-action', 'incrementHours').append(this._iconTag(this._options.icons.up))));
2095
        middleRow.append($('<td>').append($('<span>').addClass('timepicker-hour').attr({
2096
          'data-time-component': 'hours',
2097
          'title': this._options.tooltips.pickHour
2098
        }).attr('data-action', 'showHours')));
2099
        bottomRow.append($('<td>').append($('<a>').attr({
2100
          href: '#',
2101
          tabindex: '-1',
2102
          'title': this._options.tooltips.decrementHour
2103
        }).addClass('btn').attr('data-action', 'decrementHours').append(this._iconTag(this._options.icons.down))));
2104
      }
2105

2106
      if (this._isEnabled('m')) {
2107
        if (this._isEnabled('h')) {
2108
          topRow.append($('<td>').addClass('separator'));
2109
          middleRow.append($('<td>').addClass('separator').html(':'));
2110
          bottomRow.append($('<td>').addClass('separator'));
2111
        }
2112

2113
        topRow.append($('<td>').append($('<a>').attr({
2114
          href: '#',
2115
          tabindex: '-1',
2116
          'title': this._options.tooltips.incrementMinute
2117
        }).addClass('btn').attr('data-action', 'incrementMinutes').append(this._iconTag(this._options.icons.up))));
2118
        middleRow.append($('<td>').append($('<span>').addClass('timepicker-minute').attr({
2119
          'data-time-component': 'minutes',
2120
          'title': this._options.tooltips.pickMinute
2121
        }).attr('data-action', 'showMinutes')));
2122
        bottomRow.append($('<td>').append($('<a>').attr({
2123
          href: '#',
2124
          tabindex: '-1',
2125
          'title': this._options.tooltips.decrementMinute
2126
        }).addClass('btn').attr('data-action', 'decrementMinutes').append(this._iconTag(this._options.icons.down))));
2127
      }
2128

2129
      if (this._isEnabled('s')) {
2130
        if (this._isEnabled('m')) {
2131
          topRow.append($('<td>').addClass('separator'));
2132
          middleRow.append($('<td>').addClass('separator').html(':'));
2133
          bottomRow.append($('<td>').addClass('separator'));
2134
        }
2135

2136
        topRow.append($('<td>').append($('<a>').attr({
2137
          href: '#',
2138
          tabindex: '-1',
2139
          'title': this._options.tooltips.incrementSecond
2140
        }).addClass('btn').attr('data-action', 'incrementSeconds').append(this._iconTag(this._options.icons.up))));
2141
        middleRow.append($('<td>').append($('<span>').addClass('timepicker-second').attr({
2142
          'data-time-component': 'seconds',
2143
          'title': this._options.tooltips.pickSecond
2144
        }).attr('data-action', 'showSeconds')));
2145
        bottomRow.append($('<td>').append($('<a>').attr({
2146
          href: '#',
2147
          tabindex: '-1',
2148
          'title': this._options.tooltips.decrementSecond
2149
        }).addClass('btn').attr('data-action', 'decrementSeconds').append(this._iconTag(this._options.icons.down))));
2150
      }
2151

2152
      if (!this.use24Hours) {
2153
        topRow.append($('<td>').addClass('separator'));
2154
        middleRow.append($('<td>').append($('<button>').addClass('btn btn-primary').attr({
2155
          'data-action': 'togglePeriod',
2156
          tabindex: '-1',
2157
          'title': this._options.tooltips.togglePeriod
2158
        })));
2159
        bottomRow.append($('<td>').addClass('separator'));
2160
      }
2161

2162
      return $('<div>').addClass('timepicker-picker').append($('<table>').addClass('table-condensed').append([topRow, middleRow, bottomRow]));
2163
    };
2164

2165
    _proto2._getTimePickerTemplate = function _getTimePickerTemplate() {
2166
      var hoursView = $('<div>').addClass('timepicker-hours').append($('<table>').addClass('table-condensed')),
2167
          minutesView = $('<div>').addClass('timepicker-minutes').append($('<table>').addClass('table-condensed')),
2168
          secondsView = $('<div>').addClass('timepicker-seconds').append($('<table>').addClass('table-condensed')),
2169
          ret = [this._getTimePickerMainTemplate()];
2170

2171
      if (this._isEnabled('h')) {
2172
        ret.push(hoursView);
2173
      }
2174

2175
      if (this._isEnabled('m')) {
2176
        ret.push(minutesView);
2177
      }
2178

2179
      if (this._isEnabled('s')) {
2180
        ret.push(secondsView);
2181
      }
2182

2183
      return ret;
2184
    };
2185

2186
    _proto2._getToolbar = function _getToolbar() {
2187
      var row = [];
2188

2189
      if (this._options.buttons.showToday) {
2190
        row.push($('<td>').append($('<a>').attr({
2191
          href: '#',
2192
          tabindex: '-1',
2193
          'data-action': 'today',
2194
          'title': this._options.tooltips.today
2195
        }).append(this._iconTag(this._options.icons.today))));
2196
      }
2197

2198
      if (!this._options.sideBySide && this._options.collapse && this._hasDate() && this._hasTime()) {
2199
        var title, icon;
2200

2201
        if (this._options.viewMode === 'times') {
2202
          title = this._options.tooltips.selectDate;
2203
          icon = this._options.icons.date;
2204
        } else {
2205
          title = this._options.tooltips.selectTime;
2206
          icon = this._options.icons.time;
2207
        }
2208

2209
        row.push($('<td>').append($('<a>').attr({
2210
          href: '#',
2211
          tabindex: '-1',
2212
          'data-action': 'togglePicker',
2213
          'title': title
2214
        }).append(this._iconTag(icon))));
2215
      }
2216

2217
      if (this._options.buttons.showClear) {
2218
        row.push($('<td>').append($('<a>').attr({
2219
          href: '#',
2220
          tabindex: '-1',
2221
          'data-action': 'clear',
2222
          'title': this._options.tooltips.clear
2223
        }).append(this._iconTag(this._options.icons.clear))));
2224
      }
2225

2226
      if (this._options.buttons.showClose) {
2227
        row.push($('<td>').append($('<a>').attr({
2228
          href: '#',
2229
          tabindex: '-1',
2230
          'data-action': 'close',
2231
          'title': this._options.tooltips.close
2232
        }).append(this._iconTag(this._options.icons.close))));
2233
      }
2234

2235
      return row.length === 0 ? '' : $('<table>').addClass('table-condensed').append($('<tbody>').append($('<tr>').append(row)));
2236
    };
2237

2238
    _proto2._getTemplate = function _getTemplate() {
2239
      var template = $('<div>').addClass(("bootstrap-datetimepicker-widget dropdown-menu " + (this._options.calendarWeeks ? 'tempusdominus-bootstrap-datetimepicker-widget-with-calendar-weeks' : '') + " " + ((this._useFeatherIcons() ? 'tempusdominus-bootstrap-datetimepicker-widget-with-feather-icons' : '') + " ")).trim()),
2240
          dateView = $('<div>').addClass('datepicker').append(this._getDatePickerTemplate()),
2241
          timeView = $('<div>').addClass('timepicker').append(this._getTimePickerTemplate()),
2242
          content = $('<ul>').addClass('list-unstyled'),
2243
          toolbar = $('<li>').addClass(("picker-switch" + (this._options.collapse ? ' accordion-toggle' : '') + " " + ("" + (this._useFeatherIcons() ? 'picker-switch-with-feathers-icons' : ''))).trim()).append(this._getToolbar());
2244

2245
      if (this._options.inline) {
2246
        template.removeClass('dropdown-menu');
2247
      }
2248

2249
      if (this.use24Hours) {
2250
        template.addClass('usetwentyfour');
2251
      }
2252

2253
      if (this.input !== undefined && this.input.prop('readonly') || this._options.readonly) {
2254
        template.addClass('bootstrap-datetimepicker-widget-readonly');
2255
      }
2256

2257
      if (this._isEnabled('s') && !this.use24Hours) {
2258
        template.addClass('wider');
2259
      }
2260

2261
      if (this._options.sideBySide && this._hasDate() && this._hasTime()) {
2262
        template.addClass('timepicker-sbs');
2263

2264
        if (this._options.toolbarPlacement === 'top') {
2265
          template.append(toolbar);
2266
        }
2267

2268
        template.append($('<div>').addClass('row').append(dateView.addClass('col-md-6')).append(timeView.addClass('col-md-6')));
2269

2270
        if (this._options.toolbarPlacement === 'bottom' || this._options.toolbarPlacement === 'default') {
2271
          template.append(toolbar);
2272
        }
2273

2274
        return template;
2275
      }
2276

2277
      if (this._options.toolbarPlacement === 'top') {
2278
        content.append(toolbar);
2279
      }
2280

2281
      if (this._hasDate()) {
2282
        content.append($('<li>').addClass(this._options.collapse && this._hasTime() ? 'collapse' : '').addClass(this._options.collapse && this._hasTime() && this._options.viewMode === 'times' ? '' : 'show').append(dateView));
2283
      }
2284

2285
      if (this._options.toolbarPlacement === 'default') {
2286
        content.append(toolbar);
2287
      }
2288

2289
      if (this._hasTime()) {
2290
        content.append($('<li>').addClass(this._options.collapse && this._hasDate() ? 'collapse' : '').addClass(this._options.collapse && this._hasDate() && this._options.viewMode === 'times' ? 'show' : '').append(timeView));
2291
      }
2292

2293
      if (this._options.toolbarPlacement === 'bottom') {
2294
        content.append(toolbar);
2295
      }
2296

2297
      return template.append(content);
2298
    };
2299

2300
    _proto2._place = function _place(e) {
2301
      var self = e && e.data && e.data.picker || this,
2302
          vertical = self._options.widgetPositioning.vertical,
2303
          horizontal = self._options.widgetPositioning.horizontal,
2304
          parent;
2305
      var position = (self.component && self.component.length ? self.component : self._element).position(),
2306
          offset = (self.component && self.component.length ? self.component : self._element).offset();
2307

2308
      if (self._options.widgetParent) {
2309
        parent = self._options.widgetParent.append(self.widget);
2310
      } else if (self._element.is('input')) {
2311
        parent = self._element.after(self.widget).parent();
2312
      } else if (self._options.inline) {
2313
        parent = self._element.append(self.widget);
2314
        return;
2315
      } else {
2316
        parent = self._element;
2317

2318
        self._element.children().first().after(self.widget);
2319
      } // Top and bottom logic
2320

2321

2322
      if (vertical === 'auto') {
2323
        //noinspection JSValidateTypes
2324
        if (offset.top + self.widget.height() * 1.5 >= $(window).height() + $(window).scrollTop() && self.widget.height() + self._element.outerHeight() < offset.top) {
2325
          vertical = 'top';
2326
        } else {
2327
          vertical = 'bottom';
2328
        }
2329
      } // Left and right logic
2330

2331

2332
      if (horizontal === 'auto') {
2333
        if (parent.width() < offset.left + self.widget.outerWidth() / 2 && offset.left + self.widget.outerWidth() > $(window).width()) {
2334
          horizontal = 'right';
2335
        } else {
2336
          horizontal = 'left';
2337
        }
2338
      }
2339

2340
      if (vertical === 'top') {
2341
        self.widget.addClass('top').removeClass('bottom');
2342
      } else {
2343
        self.widget.addClass('bottom').removeClass('top');
2344
      }
2345

2346
      if (horizontal === 'right') {
2347
        self.widget.addClass('float-right');
2348
      } else {
2349
        self.widget.removeClass('float-right');
2350
      } // find the first parent element that has a relative css positioning
2351

2352

2353
      if (parent.css('position') !== 'relative') {
2354
        parent = parent.parents().filter(function () {
2355
          return $(this).css('position') === 'relative';
2356
        }).first();
2357
      }
2358

2359
      if (parent.length === 0) {
2360
        throw new Error('datetimepicker component should be placed within a relative positioned container');
2361
      }
2362

2363
      self.widget.css({
2364
        top: vertical === 'top' ? 'auto' : position.top + self._element.outerHeight() + 'px',
2365
        bottom: vertical === 'top' ? parent.outerHeight() - (parent === self._element ? 0 : position.top) + 'px' : 'auto',
2366
        left: horizontal === 'left' ? (parent === self._element ? 0 : position.left) + 'px' : 'auto',
2367
        right: horizontal === 'left' ? 'auto' : parent.outerWidth() - self._element.outerWidth() - (parent === self._element ? 0 : position.left) + 'px'
2368
      });
2369
    };
2370

2371
    _proto2._fillDow = function _fillDow() {
2372
      var row = $('<tr>'),
2373
          currentDate = this._viewDate.clone().startOf('w').startOf('d');
2374

2375
      if (this._options.calendarWeeks === true) {
2376
        row.append($('<th>').addClass('cw').text('#'));
2377
      }
2378

2379
      while (currentDate.isBefore(this._viewDate.clone().endOf('w'))) {
2380
        row.append($('<th>').addClass('dow').text(currentDate.format('dd')));
2381
        currentDate.add(1, 'd');
2382
      }
2383

2384
      this.widget.find('.datepicker-days thead').append(row);
2385
    };
2386

2387
    _proto2._fillMonths = function _fillMonths() {
2388
      var spans = [],
2389
          monthsShort = this._viewDate.clone().startOf('y').startOf('d');
2390

2391
      while (monthsShort.isSame(this._viewDate, 'y')) {
2392
        spans.push($('<span>').attr('data-action', 'selectMonth').addClass('month').text(monthsShort.format('MMM')));
2393
        monthsShort.add(1, 'M');
2394
      }
2395

2396
      this.widget.find('.datepicker-months td').empty().append(spans);
2397
    };
2398

2399
    _proto2._updateMonths = function _updateMonths() {
2400
      var monthsView = this.widget.find('.datepicker-months'),
2401
          monthsViewHeader = monthsView.find('th'),
2402
          months = monthsView.find('tbody').find('span'),
2403
          self = this,
2404
          lastPickedDate = this._getLastPickedDate();
2405

2406
      monthsViewHeader.eq(0).find('span').attr('title', this._options.tooltips.prevYear);
2407
      monthsViewHeader.eq(1).attr('title', this._options.tooltips.selectYear);
2408
      monthsViewHeader.eq(2).find('span').attr('title', this._options.tooltips.nextYear);
2409
      monthsView.find('.disabled').removeClass('disabled');
2410

2411
      if (!this._isValid(this._viewDate.clone().subtract(1, 'y'), 'y')) {
2412
        monthsViewHeader.eq(0).addClass('disabled');
2413
      }
2414

2415
      monthsViewHeader.eq(1).text(this._viewDate.year());
2416

2417
      if (!this._isValid(this._viewDate.clone().add(1, 'y'), 'y')) {
2418
        monthsViewHeader.eq(2).addClass('disabled');
2419
      }
2420

2421
      months.removeClass('active');
2422

2423
      if (lastPickedDate && lastPickedDate.isSame(this._viewDate, 'y') && !this.unset) {
2424
        months.eq(lastPickedDate.month()).addClass('active');
2425
      }
2426

2427
      months.each(function (index) {
2428
        if (!self._isValid(self._viewDate.clone().month(index), 'M')) {
2429
          $(this).addClass('disabled');
2430
        }
2431
      });
2432
    };
2433

2434
    _proto2._getStartEndYear = function _getStartEndYear(factor, year) {
2435
      var step = factor / 10,
2436
          startYear = Math.floor(year / factor) * factor,
2437
          endYear = startYear + step * 9,
2438
          focusValue = Math.floor(year / step) * step;
2439
      return [startYear, endYear, focusValue];
2440
    };
2441

2442
    _proto2._updateYears = function _updateYears() {
2443
      var yearsView = this.widget.find('.datepicker-years'),
2444
          yearsViewHeader = yearsView.find('th'),
2445
          yearCaps = this._getStartEndYear(10, this._viewDate.year()),
2446
          startYear = this._viewDate.clone().year(yearCaps[0]),
2447
          endYear = this._viewDate.clone().year(yearCaps[1]);
2448

2449
      var html = '';
2450
      yearsViewHeader.eq(0).find('span').attr('title', this._options.tooltips.prevDecade);
2451
      yearsViewHeader.eq(1).attr('title', this._options.tooltips.selectDecade);
2452
      yearsViewHeader.eq(2).find('span').attr('title', this._options.tooltips.nextDecade);
2453
      yearsView.find('.disabled').removeClass('disabled');
2454

2455
      if (this._options.minDate && this._options.minDate.isAfter(startYear, 'y')) {
2456
        yearsViewHeader.eq(0).addClass('disabled');
2457
      }
2458

2459
      yearsViewHeader.eq(1).text(startYear.year() + "-" + endYear.year());
2460

2461
      if (this._options.maxDate && this._options.maxDate.isBefore(endYear, 'y')) {
2462
        yearsViewHeader.eq(2).addClass('disabled');
2463
      }
2464

2465
      html += "<span data-action=\"selectYear\" class=\"year old" + (!this._isValid(startYear, 'y') ? ' disabled' : '') + "\">" + (startYear.year() - 1) + "</span>";
2466

2467
      while (!startYear.isAfter(endYear, 'y')) {
2468
        html += "<span data-action=\"selectYear\" class=\"year" + (startYear.isSame(this._getLastPickedDate(), 'y') && !this.unset ? ' active' : '') + (!this._isValid(startYear, 'y') ? ' disabled' : '') + "\">" + startYear.year() + "</span>";
2469
        startYear.add(1, 'y');
2470
      }
2471

2472
      html += "<span data-action=\"selectYear\" class=\"year old" + (!this._isValid(startYear, 'y') ? ' disabled' : '') + "\">" + startYear.year() + "</span>";
2473
      yearsView.find('td').html(html);
2474
    };
2475

2476
    _proto2._updateDecades = function _updateDecades() {
2477
      var decadesView = this.widget.find('.datepicker-decades'),
2478
          decadesViewHeader = decadesView.find('th'),
2479
          yearCaps = this._getStartEndYear(100, this._viewDate.year()),
2480
          startDecade = this._viewDate.clone().year(yearCaps[0]),
2481
          endDecade = this._viewDate.clone().year(yearCaps[1]),
2482
          lastPickedDate = this._getLastPickedDate();
2483

2484
      var minDateDecade = false,
2485
          maxDateDecade = false,
2486
          endDecadeYear,
2487
          html = '';
2488
      decadesViewHeader.eq(0).find('span').attr('title', this._options.tooltips.prevCentury);
2489
      decadesViewHeader.eq(2).find('span').attr('title', this._options.tooltips.nextCentury);
2490
      decadesView.find('.disabled').removeClass('disabled');
2491

2492
      if (startDecade.year() === 0 || this._options.minDate && this._options.minDate.isAfter(startDecade, 'y')) {
2493
        decadesViewHeader.eq(0).addClass('disabled');
2494
      }
2495

2496
      decadesViewHeader.eq(1).text(startDecade.year() + "-" + endDecade.year());
2497

2498
      if (this._options.maxDate && this._options.maxDate.isBefore(endDecade, 'y')) {
2499
        decadesViewHeader.eq(2).addClass('disabled');
2500
      }
2501

2502
      if (startDecade.year() - 10 < 0) {
2503
        html += '<span>&nbsp;</span>';
2504
      } else {
2505
        html += "<span data-action=\"selectDecade\" class=\"decade old\" data-selection=\"" + (startDecade.year() + 6) + "\">" + (startDecade.year() - 10) + "</span>";
2506
      }
2507

2508
      while (!startDecade.isAfter(endDecade, 'y')) {
2509
        endDecadeYear = startDecade.year() + 11;
2510
        minDateDecade = this._options.minDate && this._options.minDate.isAfter(startDecade, 'y') && this._options.minDate.year() <= endDecadeYear;
2511
        maxDateDecade = this._options.maxDate && this._options.maxDate.isAfter(startDecade, 'y') && this._options.maxDate.year() <= endDecadeYear;
2512
        html += "<span data-action=\"selectDecade\" class=\"decade" + (lastPickedDate && lastPickedDate.isAfter(startDecade) && lastPickedDate.year() <= endDecadeYear ? ' active' : '') + (!this._isValid(startDecade, 'y') && !minDateDecade && !maxDateDecade ? ' disabled' : '') + "\" data-selection=\"" + (startDecade.year() + 6) + "\">" + startDecade.year() + "</span>";
2513
        startDecade.add(10, 'y');
2514
      }
2515

2516
      html += "<span data-action=\"selectDecade\" class=\"decade old\" data-selection=\"" + (startDecade.year() + 6) + "\">" + startDecade.year() + "</span>";
2517
      decadesView.find('td').html(html);
2518
    };
2519

2520
    _proto2._fillDate = function _fillDate() {
2521
      _DateTimePicker.prototype._fillDate.call(this);
2522

2523
      var daysView = this.widget.find('.datepicker-days'),
2524
          daysViewHeader = daysView.find('th'),
2525
          html = [];
2526
      var currentDate, row, clsName, i;
2527

2528
      if (!this._hasDate()) {
2529
        return;
2530
      }
2531

2532
      daysViewHeader.eq(0).find('span').attr('title', this._options.tooltips.prevMonth);
2533
      daysViewHeader.eq(1).attr('title', this._options.tooltips.selectMonth);
2534
      daysViewHeader.eq(2).find('span').attr('title', this._options.tooltips.nextMonth);
2535
      daysView.find('.disabled').removeClass('disabled');
2536
      daysViewHeader.eq(1).text(this._viewDate.format(this._options.dayViewHeaderFormat));
2537

2538
      if (!this._isValid(this._viewDate.clone().subtract(1, 'M'), 'M')) {
2539
        daysViewHeader.eq(0).addClass('disabled');
2540
      }
2541

2542
      if (!this._isValid(this._viewDate.clone().add(1, 'M'), 'M')) {
2543
        daysViewHeader.eq(2).addClass('disabled');
2544
      }
2545

2546
      currentDate = this._viewDate.clone().startOf('M').startOf('w').startOf('d');
2547

2548
      for (i = 0; i < 42; i++) {
2549
        //always display 42 days (should show 6 weeks)
2550
        if (currentDate.weekday() === 0) {
2551
          row = $('<tr>');
2552

2553
          if (this._options.calendarWeeks) {
2554
            row.append("<td class=\"cw\">" + currentDate.week() + "</td>");
2555
          }
2556

2557
          html.push(row);
2558
        }
2559

2560
        clsName = '';
2561

2562
        if (currentDate.isBefore(this._viewDate, 'M')) {
2563
          clsName += ' old';
2564
        }
2565

2566
        if (currentDate.isAfter(this._viewDate, 'M')) {
2567
          clsName += ' new';
2568
        }
2569

2570
        if (this._options.allowMultidate) {
2571
          var index = this._datesFormatted.indexOf(currentDate.format('YYYY-MM-DD'));
2572

2573
          if (index !== -1) {
2574
            if (currentDate.isSame(this._datesFormatted[index], 'd') && !this.unset) {
2575
              clsName += ' active';
2576
            }
2577
          }
2578
        } else {
2579
          if (currentDate.isSame(this._getLastPickedDate(), 'd') && !this.unset) {
2580
            clsName += ' active';
2581
          }
2582
        }
2583

2584
        if (!this._isValid(currentDate, 'd')) {
2585
          clsName += ' disabled';
2586
        }
2587

2588
        if (currentDate.isSame(this.getMoment(), 'd')) {
2589
          clsName += ' today';
2590
        }
2591

2592
        if (currentDate.day() === 0 || currentDate.day() === 6) {
2593
          clsName += ' weekend';
2594
        }
2595

2596
        row.append("<td data-action=\"selectDay\" data-day=\"" + currentDate.format('L') + "\" class=\"day" + clsName + "\">" + currentDate.date() + "</td>");
2597
        currentDate.add(1, 'd');
2598
      }
2599

2600
      $('body').addClass('tempusdominus-bootstrap-datetimepicker-widget-day-click');
2601
      $('body').append('<div class="tempusdominus-bootstrap-datetimepicker-widget-day-click-glass-panel"></div>');
2602
      daysView.find('tbody').empty().append(html);
2603
      $('body').find('.tempusdominus-bootstrap-datetimepicker-widget-day-click-glass-panel').remove();
2604
      $('body').removeClass('tempusdominus-bootstrap-datetimepicker-widget-day-click');
2605

2606
      this._updateMonths();
2607

2608
      this._updateYears();
2609

2610
      this._updateDecades();
2611
    };
2612

2613
    _proto2._fillHours = function _fillHours() {
2614
      var table = this.widget.find('.timepicker-hours table'),
2615
          currentHour = this._viewDate.clone().startOf('d'),
2616
          html = [];
2617

2618
      var row = $('<tr>');
2619

2620
      if (this._viewDate.hour() > 11 && !this.use24Hours) {
2621
        currentHour.hour(12);
2622
      }
2623

2624
      while (currentHour.isSame(this._viewDate, 'd') && (this.use24Hours || this._viewDate.hour() < 12 && currentHour.hour() < 12 || this._viewDate.hour() > 11)) {
2625
        if (currentHour.hour() % 4 === 0) {
2626
          row = $('<tr>');
2627
          html.push(row);
2628
        }
2629

2630
        row.append("<td data-action=\"selectHour\" class=\"hour" + (!this._isValid(currentHour, 'h') ? ' disabled' : '') + "\">" + currentHour.format(this.use24Hours ? 'HH' : 'hh') + "</td>");
2631
        currentHour.add(1, 'h');
2632
      }
2633

2634
      table.empty().append(html);
2635
    };
2636

2637
    _proto2._fillMinutes = function _fillMinutes() {
2638
      var table = this.widget.find('.timepicker-minutes table'),
2639
          currentMinute = this._viewDate.clone().startOf('h'),
2640
          html = [],
2641
          step = this._options.stepping === 1 ? 5 : this._options.stepping;
2642

2643
      var row = $('<tr>');
2644

2645
      while (this._viewDate.isSame(currentMinute, 'h')) {
2646
        if (currentMinute.minute() % (step * 4) === 0) {
2647
          row = $('<tr>');
2648
          html.push(row);
2649
        }
2650

2651
        row.append("<td data-action=\"selectMinute\" class=\"minute" + (!this._isValid(currentMinute, 'm') ? ' disabled' : '') + "\">" + currentMinute.format('mm') + "</td>");
2652
        currentMinute.add(step, 'm');
2653
      }
2654

2655
      table.empty().append(html);
2656
    };
2657

2658
    _proto2._fillSeconds = function _fillSeconds() {
2659
      var table = this.widget.find('.timepicker-seconds table'),
2660
          currentSecond = this._viewDate.clone().startOf('m'),
2661
          html = [];
2662

2663
      var row = $('<tr>');
2664

2665
      while (this._viewDate.isSame(currentSecond, 'm')) {
2666
        if (currentSecond.second() % 20 === 0) {
2667
          row = $('<tr>');
2668
          html.push(row);
2669
        }
2670

2671
        row.append("<td data-action=\"selectSecond\" class=\"second" + (!this._isValid(currentSecond, 's') ? ' disabled' : '') + "\">" + currentSecond.format('ss') + "</td>");
2672
        currentSecond.add(5, 's');
2673
      }
2674

2675
      table.empty().append(html);
2676
    };
2677

2678
    _proto2._fillTime = function _fillTime() {
2679
      var toggle, newDate;
2680

2681
      var timeComponents = this.widget.find('.timepicker span[data-time-component]'),
2682
          lastPickedDate = this._getLastPickedDate();
2683

2684
      if (!this.use24Hours) {
2685
        toggle = this.widget.find('.timepicker [data-action=togglePeriod]');
2686
        newDate = lastPickedDate ? lastPickedDate.clone().add(lastPickedDate.hours() >= 12 ? -12 : 12, 'h') : void 0;
2687
        lastPickedDate && toggle.text(lastPickedDate.format('A'));
2688

2689
        if (this._isValid(newDate, 'h')) {
2690
          toggle.removeClass('disabled');
2691
        } else {
2692
          toggle.addClass('disabled');
2693
        }
2694
      }
2695

2696
      lastPickedDate && timeComponents.filter('[data-time-component=hours]').text(lastPickedDate.format("" + (this.use24Hours ? 'HH' : 'hh')));
2697
      lastPickedDate && timeComponents.filter('[data-time-component=minutes]').text(lastPickedDate.format('mm'));
2698
      lastPickedDate && timeComponents.filter('[data-time-component=seconds]').text(lastPickedDate.format('ss'));
2699

2700
      this._fillHours();
2701

2702
      this._fillMinutes();
2703

2704
      this._fillSeconds();
2705
    };
2706

2707
    _proto2._doAction = function _doAction(e, action) {
2708
      var lastPicked = this._getLastPickedDate();
2709

2710
      if ($(e.currentTarget).is('.disabled')) {
2711
        return false;
2712
      }
2713

2714
      action = action || $(e.currentTarget).data('action');
2715

2716
      switch (action) {
2717
        case 'next':
2718
          {
2719
            var navFnc = DateTimePicker.DatePickerModes[this.currentViewMode].NAV_FUNCTION;
2720

2721
            this._viewDate.add(DateTimePicker.DatePickerModes[this.currentViewMode].NAV_STEP, navFnc);
2722

2723
            this._fillDate();
2724

2725
            this._viewUpdate(navFnc);
2726

2727
            break;
2728
          }
2729

2730
        case 'previous':
2731
          {
2732
            var _navFnc = DateTimePicker.DatePickerModes[this.currentViewMode].NAV_FUNCTION;
2733

2734
            this._viewDate.subtract(DateTimePicker.DatePickerModes[this.currentViewMode].NAV_STEP, _navFnc);
2735

2736
            this._fillDate();
2737

2738
            this._viewUpdate(_navFnc);
2739

2740
            break;
2741
          }
2742

2743
        case 'pickerSwitch':
2744
          this._showMode(1);
2745

2746
          break;
2747

2748
        case 'selectMonth':
2749
          {
2750
            var month = $(e.target).closest('tbody').find('span').index($(e.target));
2751

2752
            this._viewDate.month(month);
2753

2754
            if (this.currentViewMode === this.MinViewModeNumber) {
2755
              this._setValue(lastPicked.clone().year(this._viewDate.year()).month(this._viewDate.month()), this._getLastPickedDateIndex());
2756

2757
              if (!this._options.inline) {
2758
                this.hide();
2759
              }
2760
            } else {
2761
              this._showMode(-1);
2762

2763
              this._fillDate();
2764
            }
2765

2766
            this._viewUpdate('M');
2767

2768
            break;
2769
          }
2770

2771
        case 'selectYear':
2772
          {
2773
            var year = parseInt($(e.target).text(), 10) || 0;
2774

2775
            this._viewDate.year(year);
2776

2777
            if (this.currentViewMode === this.MinViewModeNumber) {
2778
              this._setValue(lastPicked.clone().year(this._viewDate.year()), this._getLastPickedDateIndex());
2779

2780
              if (!this._options.inline) {
2781
                this.hide();
2782
              }
2783
            } else {
2784
              this._showMode(-1);
2785

2786
              this._fillDate();
2787
            }
2788

2789
            this._viewUpdate('YYYY');
2790

2791
            break;
2792
          }
2793

2794
        case 'selectDecade':
2795
          {
2796
            var _year = parseInt($(e.target).data('selection'), 10) || 0;
2797

2798
            this._viewDate.year(_year);
2799

2800
            if (this.currentViewMode === this.MinViewModeNumber) {
2801
              this._setValue(lastPicked.clone().year(this._viewDate.year()), this._getLastPickedDateIndex());
2802

2803
              if (!this._options.inline) {
2804
                this.hide();
2805
              }
2806
            } else {
2807
              this._showMode(-1);
2808

2809
              this._fillDate();
2810
            }
2811

2812
            this._viewUpdate('YYYY');
2813

2814
            break;
2815
          }
2816

2817
        case 'selectDay':
2818
          {
2819
            var day = this._viewDate.clone();
2820

2821
            if ($(e.target).is('.old')) {
2822
              day.subtract(1, 'M');
2823
            }
2824

2825
            if ($(e.target).is('.new')) {
2826
              day.add(1, 'M');
2827
            }
2828

2829
            var selectDate = day.date(parseInt($(e.target).text(), 10)),
2830
                index = 0;
2831

2832
            if (this._options.allowMultidate) {
2833
              index = this._datesFormatted.indexOf(selectDate.format('YYYY-MM-DD'));
2834

2835
              if (index !== -1) {
2836
                this._setValue(null, index); //deselect multidate
2837

2838
              } else {
2839
                this._setValue(selectDate, this._getLastPickedDateIndex() + 1);
2840
              }
2841
            } else {
2842
              this._setValue(selectDate, this._getLastPickedDateIndex());
2843
            }
2844

2845
            if (!this._hasTime() && !this._options.keepOpen && !this._options.inline && !this._options.allowMultidate) {
2846
              this.hide();
2847
            }
2848

2849
            break;
2850
          }
2851

2852
        case 'incrementHours':
2853
          {
2854
            if (!lastPicked) {
2855
              break;
2856
            }
2857

2858
            var newDate = lastPicked.clone().add(1, 'h');
2859

2860
            if (this._isValid(newDate, 'h')) {
2861
              if (this._getLastPickedDateIndex() < 0) {
2862
                this.date(newDate);
2863
              }
2864

2865
              this._setValue(newDate, this._getLastPickedDateIndex());
2866
            }
2867

2868
            break;
2869
          }
2870

2871
        case 'incrementMinutes':
2872
          {
2873
            if (!lastPicked) {
2874
              break;
2875
            }
2876

2877
            var _newDate = lastPicked.clone().add(this._options.stepping, 'm');
2878

2879
            if (this._isValid(_newDate, 'm')) {
2880
              if (this._getLastPickedDateIndex() < 0) {
2881
                this.date(_newDate);
2882
              }
2883

2884
              this._setValue(_newDate, this._getLastPickedDateIndex());
2885
            }
2886

2887
            break;
2888
          }
2889

2890
        case 'incrementSeconds':
2891
          {
2892
            if (!lastPicked) {
2893
              break;
2894
            }
2895

2896
            var _newDate2 = lastPicked.clone().add(1, 's');
2897

2898
            if (this._isValid(_newDate2, 's')) {
2899
              if (this._getLastPickedDateIndex() < 0) {
2900
                this.date(_newDate2);
2901
              }
2902

2903
              this._setValue(_newDate2, this._getLastPickedDateIndex());
2904
            }
2905

2906
            break;
2907
          }
2908

2909
        case 'decrementHours':
2910
          {
2911
            if (!lastPicked) {
2912
              break;
2913
            }
2914

2915
            var _newDate3 = lastPicked.clone().subtract(1, 'h');
2916

2917
            if (this._isValid(_newDate3, 'h')) {
2918
              if (this._getLastPickedDateIndex() < 0) {
2919
                this.date(_newDate3);
2920
              }
2921

2922
              this._setValue(_newDate3, this._getLastPickedDateIndex());
2923
            }
2924

2925
            break;
2926
          }
2927

2928
        case 'decrementMinutes':
2929
          {
2930
            if (!lastPicked) {
2931
              break;
2932
            }
2933

2934
            var _newDate4 = lastPicked.clone().subtract(this._options.stepping, 'm');
2935

2936
            if (this._isValid(_newDate4, 'm')) {
2937
              if (this._getLastPickedDateIndex() < 0) {
2938
                this.date(_newDate4);
2939
              }
2940

2941
              this._setValue(_newDate4, this._getLastPickedDateIndex());
2942
            }
2943

2944
            break;
2945
          }
2946

2947
        case 'decrementSeconds':
2948
          {
2949
            if (!lastPicked) {
2950
              break;
2951
            }
2952

2953
            var _newDate5 = lastPicked.clone().subtract(1, 's');
2954

2955
            if (this._isValid(_newDate5, 's')) {
2956
              if (this._getLastPickedDateIndex() < 0) {
2957
                this.date(_newDate5);
2958
              }
2959

2960
              this._setValue(_newDate5, this._getLastPickedDateIndex());
2961
            }
2962

2963
            break;
2964
          }
2965

2966
        case 'togglePeriod':
2967
          {
2968
            this._setValue(lastPicked.clone().add(lastPicked.hours() >= 12 ? -12 : 12, 'h'), this._getLastPickedDateIndex());
2969

2970
            break;
2971
          }
2972

2973
        case 'togglePicker':
2974
          {
2975
            var $this = $(e.target),
2976
                $link = $this.closest('a'),
2977
                $parent = $this.closest('ul'),
2978
                expanded = $parent.find('.show'),
2979
                closed = $parent.find('.collapse:not(.show)'),
2980
                $span = $this.is('span') ? $this : $this.find('span');
2981
            var collapseData, inactiveIcon, iconTest;
2982

2983
            if (expanded && expanded.length) {
2984
              collapseData = expanded.data('collapse');
2985

2986
              if (collapseData && collapseData.transitioning) {
2987
                return true;
2988
              }
2989

2990
              if (expanded.collapse) {
2991
                // if collapse plugin is available through bootstrap.js then use it
2992
                expanded.collapse('hide');
2993
                closed.collapse('show');
2994
              } else {
2995
                // otherwise just toggle in class on the two views
2996
                expanded.removeClass('show');
2997
                closed.addClass('show');
2998
              }
2999

3000
              if (this._useFeatherIcons()) {
3001
                $link.toggleClass(this._options.icons.time + ' ' + this._options.icons.date);
3002
                inactiveIcon = $link.hasClass(this._options.icons.time) ? this._options.icons.date : this._options.icons.time;
3003
                $link.html(this._iconTag(inactiveIcon));
3004
              } else {
3005
                $span.toggleClass(this._options.icons.time + ' ' + this._options.icons.date);
3006
              }
3007

3008
              if (this._useFeatherIcons()) {
3009
                iconTest = $link.hasClass(this._options.icons.date);
3010
              } else {
3011
                iconTest = $span.hasClass(this._options.icons.date);
3012
              }
3013

3014
              if (iconTest) {
3015
                $link.attr('title', this._options.tooltips.selectDate);
3016
              } else {
3017
                $link.attr('title', this._options.tooltips.selectTime);
3018
              }
3019
            }
3020
          }
3021
          break;
3022

3023
        case 'showPicker':
3024
          this.widget.find('.timepicker > div:not(.timepicker-picker)').hide();
3025
          this.widget.find('.timepicker .timepicker-picker').show();
3026
          break;
3027

3028
        case 'showHours':
3029
          this.widget.find('.timepicker .timepicker-picker').hide();
3030
          this.widget.find('.timepicker .timepicker-hours').show();
3031
          break;
3032

3033
        case 'showMinutes':
3034
          this.widget.find('.timepicker .timepicker-picker').hide();
3035
          this.widget.find('.timepicker .timepicker-minutes').show();
3036
          break;
3037

3038
        case 'showSeconds':
3039
          this.widget.find('.timepicker .timepicker-picker').hide();
3040
          this.widget.find('.timepicker .timepicker-seconds').show();
3041
          break;
3042

3043
        case 'selectHour':
3044
          {
3045
            var hour = parseInt($(e.target).text(), 10);
3046

3047
            if (!this.use24Hours) {
3048
              if (lastPicked.hours() >= 12) {
3049
                if (hour !== 12) {
3050
                  hour += 12;
3051
                }
3052
              } else {
3053
                if (hour === 12) {
3054
                  hour = 0;
3055
                }
3056
              }
3057
            }
3058

3059
            this._setValue(lastPicked.clone().hours(hour), this._getLastPickedDateIndex());
3060

3061
            if (!this._isEnabled('a') && !this._isEnabled('m') && !this._options.keepOpen && !this._options.inline) {
3062
              this.hide();
3063
            } else {
3064
              this._doAction(e, 'showPicker');
3065
            }
3066

3067
            break;
3068
          }
3069

3070
        case 'selectMinute':
3071
          this._setValue(lastPicked.clone().minutes(parseInt($(e.target).text(), 10)), this._getLastPickedDateIndex());
3072

3073
          if (!this._isEnabled('a') && !this._isEnabled('s') && !this._options.keepOpen && !this._options.inline) {
3074
            this.hide();
3075
          } else {
3076
            this._doAction(e, 'showPicker');
3077
          }
3078

3079
          break;
3080

3081
        case 'selectSecond':
3082
          this._setValue(lastPicked.clone().seconds(parseInt($(e.target).text(), 10)), this._getLastPickedDateIndex());
3083

3084
          if (!this._isEnabled('a') && !this._options.keepOpen && !this._options.inline) {
3085
            this.hide();
3086
          } else {
3087
            this._doAction(e, 'showPicker');
3088
          }
3089

3090
          break;
3091

3092
        case 'clear':
3093
          this.clear();
3094
          break;
3095

3096
        case 'close':
3097
          this.hide();
3098
          break;
3099

3100
        case 'today':
3101
          {
3102
            var todaysDate = this.getMoment();
3103

3104
            if (this._isValid(todaysDate, 'd')) {
3105
              this._setValue(todaysDate, this._getLastPickedDateIndex());
3106
            }
3107

3108
            break;
3109
          }
3110
      }
3111

3112
      return false;
3113
    } //public
3114
    ;
3115

3116
    _proto2.hide = function hide() {
3117
      var transitioning = false;
3118

3119
      if (!this.widget) {
3120
        return;
3121
      } // Ignore event if in the middle of a picker transition
3122

3123

3124
      this.widget.find('.collapse').each(function () {
3125
        var collapseData = $(this).data('collapse');
3126

3127
        if (collapseData && collapseData.transitioning) {
3128
          transitioning = true;
3129
          return false;
3130
        }
3131

3132
        return true;
3133
      });
3134

3135
      if (transitioning) {
3136
        return;
3137
      }
3138

3139
      if (this.component && this.component.hasClass('btn')) {
3140
        this.component.toggleClass('active');
3141
      }
3142

3143
      this.widget.hide();
3144
      $(window).off('resize', this._place);
3145
      this.widget.off('click', '[data-action]');
3146
      this.widget.off('mousedown', false);
3147
      this.widget.remove();
3148
      this.widget = false;
3149

3150
      if (this.input !== undefined && this.input.val() !== undefined && this.input.val().trim().length !== 0) {
3151
        this._setValue(this._parseInputDate(this.input.val().trim(), {
3152
          isPickerShow: false
3153
        }), 0);
3154
      }
3155

3156
      var lastPickedDate = this._getLastPickedDate();
3157

3158
      this._notifyEvent({
3159
        type: DateTimePicker.Event.HIDE,
3160
        date: this.unset ? null : lastPickedDate ? lastPickedDate.clone() : void 0
3161
      });
3162

3163
      if (this.input !== undefined) {
3164
        this.input.blur();
3165
      }
3166

3167
      this._viewDate = lastPickedDate ? lastPickedDate.clone() : this.getMoment();
3168
    };
3169

3170
    _proto2.show = function show() {
3171
      var currentMoment,
3172
          shouldUseCurrentIfUnset = false;
3173
      var useCurrentGranularity = {
3174
        'year': function year(m) {
3175
          return m.month(0).date(1).hours(0).seconds(0).minutes(0);
3176
        },
3177
        'month': function month(m) {
3178
          return m.date(1).hours(0).seconds(0).minutes(0);
3179
        },
3180
        'day': function day(m) {
3181
          return m.hours(0).seconds(0).minutes(0);
3182
        },
3183
        'hour': function hour(m) {
3184
          return m.seconds(0).minutes(0);
3185
        },
3186
        'minute': function minute(m) {
3187
          return m.seconds(0);
3188
        }
3189
      };
3190

3191
      if (this.input !== undefined) {
3192
        if (this.input.prop('disabled') || !this._options.ignoreReadonly && this.input.prop('readonly') || this.widget) {
3193
          return;
3194
        }
3195

3196
        if (this.input.val() !== undefined && this.input.val().trim().length !== 0) {
3197
          this._setValue(this._parseInputDate(this.input.val().trim(), {
3198
            isPickerShow: true
3199
          }), 0);
3200
        } else {
3201
          shouldUseCurrentIfUnset = true;
3202
        }
3203
      } else {
3204
        shouldUseCurrentIfUnset = true;
3205
      }
3206

3207
      if (shouldUseCurrentIfUnset && this.unset && this._options.useCurrent) {
3208
        currentMoment = this.getMoment();
3209

3210
        if (typeof this._options.useCurrent === 'string') {
3211
          currentMoment = useCurrentGranularity[this._options.useCurrent](currentMoment);
3212
        }
3213

3214
        this._setValue(currentMoment, 0);
3215
      }
3216

3217
      this.widget = this._getTemplate();
3218

3219
      this._fillDow();
3220

3221
      this._fillMonths();
3222

3223
      this.widget.find('.timepicker-hours').hide();
3224
      this.widget.find('.timepicker-minutes').hide();
3225
      this.widget.find('.timepicker-seconds').hide();
3226

3227
      this._update();
3228

3229
      this._showMode();
3230

3231
      $(window).on('resize', {
3232
        picker: this
3233
      }, this._place);
3234
      this.widget.on('click', '[data-action]', $.proxy(this._doAction, this)); // this handles clicks on the widget
3235

3236
      this.widget.on('mousedown', false);
3237

3238
      if (this.component && this.component.hasClass('btn')) {
3239
        this.component.toggleClass('active');
3240
      }
3241

3242
      this._place();
3243

3244
      this.widget.show();
3245

3246
      if (this.input !== undefined && this._options.focusOnShow && !this.input.is(':focus')) {
3247
        this.input.focus();
3248
      }
3249

3250
      this._notifyEvent({
3251
        type: DateTimePicker.Event.SHOW
3252
      });
3253
    };
3254

3255
    _proto2.destroy = function destroy() {
3256
      this.hide(); //todo doc off?
3257

3258
      this._element.removeData(DateTimePicker.DATA_KEY);
3259

3260
      this._element.removeData('date');
3261
    };
3262

3263
    _proto2.disable = function disable() {
3264
      this.hide();
3265

3266
      if (this.component && this.component.hasClass('btn')) {
3267
        this.component.addClass('disabled');
3268
      }
3269

3270
      if (this.input !== undefined) {
3271
        this.input.prop('disabled', true); //todo disable this/comp if input is null
3272
      }
3273
    };
3274

3275
    _proto2.enable = function enable() {
3276
      if (this.component && this.component.hasClass('btn')) {
3277
        this.component.removeClass('disabled');
3278
      }
3279

3280
      if (this.input !== undefined) {
3281
        this.input.prop('disabled', false); //todo enable comp/this if input is null
3282
      }
3283
    };
3284

3285
    _proto2.toolbarPlacement = function toolbarPlacement(_toolbarPlacement) {
3286
      if (arguments.length === 0) {
3287
        return this._options.toolbarPlacement;
3288
      }
3289

3290
      if (typeof _toolbarPlacement !== 'string') {
3291
        throw new TypeError('toolbarPlacement() expects a string parameter');
3292
      }
3293

3294
      if (toolbarPlacements.indexOf(_toolbarPlacement) === -1) {
3295
        throw new TypeError("toolbarPlacement() parameter must be one of (" + toolbarPlacements.join(', ') + ") value");
3296
      }
3297

3298
      this._options.toolbarPlacement = _toolbarPlacement;
3299

3300
      if (this.widget) {
3301
        this.hide();
3302
        this.show();
3303
      }
3304
    };
3305

3306
    _proto2.widgetPositioning = function widgetPositioning(_widgetPositioning) {
3307
      if (arguments.length === 0) {
3308
        return $.extend({}, this._options.widgetPositioning);
3309
      }
3310

3311
      if ({}.toString.call(_widgetPositioning) !== '[object Object]') {
3312
        throw new TypeError('widgetPositioning() expects an object variable');
3313
      }
3314

3315
      if (_widgetPositioning.horizontal) {
3316
        if (typeof _widgetPositioning.horizontal !== 'string') {
3317
          throw new TypeError('widgetPositioning() horizontal variable must be a string');
3318
        }
3319

3320
        _widgetPositioning.horizontal = _widgetPositioning.horizontal.toLowerCase();
3321

3322
        if (horizontalModes.indexOf(_widgetPositioning.horizontal) === -1) {
3323
          throw new TypeError("widgetPositioning() expects horizontal parameter to be one of (" + horizontalModes.join(', ') + ")");
3324
        }
3325

3326
        this._options.widgetPositioning.horizontal = _widgetPositioning.horizontal;
3327
      }
3328

3329
      if (_widgetPositioning.vertical) {
3330
        if (typeof _widgetPositioning.vertical !== 'string') {
3331
          throw new TypeError('widgetPositioning() vertical variable must be a string');
3332
        }
3333

3334
        _widgetPositioning.vertical = _widgetPositioning.vertical.toLowerCase();
3335

3336
        if (verticalModes.indexOf(_widgetPositioning.vertical) === -1) {
3337
          throw new TypeError("widgetPositioning() expects vertical parameter to be one of (" + verticalModes.join(', ') + ")");
3338
        }
3339

3340
        this._options.widgetPositioning.vertical = _widgetPositioning.vertical;
3341
      }
3342

3343
      this._update();
3344
    };
3345

3346
    _proto2.widgetParent = function widgetParent(_widgetParent) {
3347
      if (arguments.length === 0) {
3348
        return this._options.widgetParent;
3349
      }
3350

3351
      if (typeof _widgetParent === 'string') {
3352
        _widgetParent = $(_widgetParent);
3353
      }
3354

3355
      if (_widgetParent !== null && typeof _widgetParent !== 'string' && !(_widgetParent instanceof $)) {
3356
        throw new TypeError('widgetParent() expects a string or a jQuery object parameter');
3357
      }
3358

3359
      this._options.widgetParent = _widgetParent;
3360

3361
      if (this.widget) {
3362
        this.hide();
3363
        this.show();
3364
      }
3365
    };
3366

3367
    _proto2.setMultiDate = function setMultiDate(multiDateArray) {
3368
      var dateFormat = this._options.format;
3369
      this.clear();
3370

3371
      for (var index = 0; index < multiDateArray.length; index++) {
3372
        var date = moment(multiDateArray[index], dateFormat);
3373

3374
        this._setValue(date, index);
3375
      }
3376
    } //static
3377
    ;
3378

3379
    TempusDominusBootstrap4._jQueryHandleThis = function _jQueryHandleThis(me, option, argument) {
3380
      var data = $(me).data(DateTimePicker.DATA_KEY);
3381

3382
      if (typeof option === 'object') {
3383
        $.extend({}, DateTimePicker.Default, option);
3384
      }
3385

3386
      if (!data) {
3387
        data = new TempusDominusBootstrap4($(me), option);
3388
        $(me).data(DateTimePicker.DATA_KEY, data);
3389
      }
3390

3391
      if (typeof option === 'string') {
3392
        if (data[option] === undefined) {
3393
          throw new Error("No method named \"" + option + "\"");
3394
        }
3395

3396
        if (argument === undefined) {
3397
          return data[option]();
3398
        } else {
3399
          if (option === 'date') {
3400
            data.isDateUpdateThroughDateOptionFromClientCode = true;
3401
          }
3402

3403
          var ret = data[option](argument);
3404
          data.isDateUpdateThroughDateOptionFromClientCode = false;
3405
          return ret;
3406
        }
3407
      }
3408
    };
3409

3410
    TempusDominusBootstrap4._jQueryInterface = function _jQueryInterface(option, argument) {
3411
      if (this.length === 1) {
3412
        return TempusDominusBootstrap4._jQueryHandleThis(this[0], option, argument);
3413
      }
3414

3415
      return this.each(function () {
3416
        TempusDominusBootstrap4._jQueryHandleThis(this, option, argument);
3417
      });
3418
    };
3419

3420
    return TempusDominusBootstrap4;
3421
  }(DateTimePicker);
3422
  /**
3423
  * ------------------------------------------------------------------------
3424
  * jQuery
3425
  * ------------------------------------------------------------------------
3426
  */
3427

3428

3429
  $(document).on(DateTimePicker.Event.CLICK_DATA_API, DateTimePicker.Selector.DATA_TOGGLE, function () {
3430
    var $originalTarget = $(this),
3431
        $target = getSelectorFromElement($originalTarget),
3432
        config = $target.data(DateTimePicker.DATA_KEY);
3433

3434
    if ($target.length === 0) {
3435
      return;
3436
    }
3437

3438
    if (config._options.allowInputToggle && $originalTarget.is('input[data-toggle="datetimepicker"]')) {
3439
      return;
3440
    }
3441

3442
    TempusDominusBootstrap4._jQueryInterface.call($target, 'toggle');
3443
  }).on(DateTimePicker.Event.CHANGE, "." + DateTimePicker.ClassName.INPUT, function (event) {
3444
    var $target = getSelectorFromElement($(this));
3445

3446
    if ($target.length === 0 || event.isInit) {
3447
      return;
3448
    }
3449

3450
    TempusDominusBootstrap4._jQueryInterface.call($target, '_change', event);
3451
  }).on(DateTimePicker.Event.BLUR, "." + DateTimePicker.ClassName.INPUT, function (event) {
3452
    var $target = getSelectorFromElement($(this)),
3453
        config = $target.data(DateTimePicker.DATA_KEY);
3454

3455
    if ($target.length === 0) {
3456
      return;
3457
    }
3458

3459
    if (config._options.debug || window.debug) {
3460
      return;
3461
    }
3462

3463
    TempusDominusBootstrap4._jQueryInterface.call($target, 'hide', event);
3464
  }).on(DateTimePicker.Event.KEYDOWN, "." + DateTimePicker.ClassName.INPUT, function (event) {
3465
    var $target = getSelectorFromElement($(this));
3466

3467
    if ($target.length === 0) {
3468
      return;
3469
    }
3470

3471
    TempusDominusBootstrap4._jQueryInterface.call($target, '_keydown', event);
3472
  }).on(DateTimePicker.Event.KEYUP, "." + DateTimePicker.ClassName.INPUT, function (event) {
3473
    var $target = getSelectorFromElement($(this));
3474

3475
    if ($target.length === 0) {
3476
      return;
3477
    }
3478

3479
    TempusDominusBootstrap4._jQueryInterface.call($target, '_keyup', event);
3480
  }).on(DateTimePicker.Event.FOCUS, "." + DateTimePicker.ClassName.INPUT, function (event) {
3481
    var $target = getSelectorFromElement($(this)),
3482
        config = $target.data(DateTimePicker.DATA_KEY);
3483

3484
    if ($target.length === 0) {
3485
      return;
3486
    }
3487

3488
    if (!config._options.allowInputToggle) {
3489
      return;
3490
    }
3491

3492
    TempusDominusBootstrap4._jQueryInterface.call($target, 'show', event);
3493
  });
3494
  $.fn[DateTimePicker.NAME] = TempusDominusBootstrap4._jQueryInterface;
3495
  $.fn[DateTimePicker.NAME].Constructor = TempusDominusBootstrap4;
3496

3497
  $.fn[DateTimePicker.NAME].noConflict = function () {
3498
    $.fn[DateTimePicker.NAME] = JQUERY_NO_CONFLICT;
3499
    return TempusDominusBootstrap4._jQueryInterface;
3500
  };
3501

3502
  return TempusDominusBootstrap4;
3503
}(jQuery);
3504

3505
}();
3506

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.