Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tempusdominus-core

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tempusdominus-core - npm Package Compare versions

Comparing version 5.0.0-alpha6 to 5.0.0-alpha7

build/nuget/Tempus.Dominus.Core.5.0.0-alpha7.nupkg

207

build/js/tempusdominus-core.js

@@ -5,5 +5,7 @@ var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

// ReSharper disable once InconsistentNaming
var DateTimePicker = function ($) {
// ReSharper disable InconsistentNaming
var NAME = 'datetimepicker',
VERSION = '5.0.0-alpha.4',
VERSION = '5.0.0-alpha7',
DATA_KEY = '' + NAME,

@@ -233,3 +235,5 @@ EVENT_KEY = '.' + DATA_KEY,

enabledHours: false,
viewDate: false
viewDate: false,
allowMultidate: false,
multidateSeparator: ','
},

@@ -283,8 +287,12 @@ DatePickerModes = [{

},
ViewModes = ['times', 'days', 'months', 'years', 'decades'];
var MinViewModeNumber = 0,
ViewModes = ['times', 'days', 'months', 'years', 'decades'],
keyState = {},
keyPressHandled = {};
var MinViewModeNumber = 0;
// ReSharper restore InconsistentNaming
// ReSharper disable once DeclarationHides
// ReSharper disable once InconsistentNaming
var DateTimePicker = function () {

@@ -299,3 +307,4 @@ /** @namespace eData.dateOptions */

this._element = element;
this._date = null;
this._dates = [];
this._datesFormatted = [];
this._viewDate = null;

@@ -332,4 +341,5 @@ this.unset = true;

this._date = this.getMoment();
this._viewDate = this._date.clone();
this._dates = [];
this._dates[0] = this.getMoment();
this._viewDate = this.getMoment().clone();

@@ -360,13 +370,20 @@ $.extend(true, this._options, this._dataToOptions());

DateTimePicker.prototype._setValue = function _setValue(targetMoment) {
var oldDate = this.unset ? null : this._date;
DateTimePicker.prototype._setValue = function _setValue(targetMoment, index) {
var oldDate = this.unset ? null : this._dates[index];
var outpValue = '';
// case of calling setValue(null or false)
if (!targetMoment) {
this.unset = true;
if (!this._options.allowMultidate || this._dates.length === 1) {
this.unset = true;
} else {
outpValue = this._element.data('date') + ',';
outpValue = outpValue.replace(oldDate.format(this.actualFormat) + ',', '').replace(',,', '').replace(/,\s*$/, '');
this._dates.splice(index, 1);
this._datesFormatted.splice(index, 1);
}
if (this.input !== undefined) {
this.input.val('');
this.input.val(outpValue);
this.input.trigger('input');
}
this._element.data('date', '');
this._element.data('date', outpValue);
this._notifyEvent({

@@ -392,9 +409,19 @@ type: DateTimePicker.Event.CHANGE,

if (this._isValid(targetMoment)) {
this._date = targetMoment;
this._dates[index] = targetMoment;
this._datesFormatted[index] = targetMoment.format('YYYY-MM-DD');
this._viewDate = targetMoment.clone();
if (this._options.allowMultidate && this._dates.length > 1) {
for (var i = 0; i < this._dates.length; i++) {
outpValue += '' + this._dates[i].format(this.actualFormat) + this._options.multidateSeparator;
}
outpValue = outpValue.replace(/,\s*$/, '');
} else {
outpValue = this._dates[index].format(this.actualFormat);
}
if (this.input !== undefined) {
this.input.val(this._date.format(this.actualFormat));
this.input.val(outpValue);
this.input.trigger('input');
}
this._element.data('date', this._date.format(this.actualFormat));
this._element.data('date', outpValue);
this.unset = false;

@@ -404,3 +431,3 @@ this._update();

type: DateTimePicker.Event.CHANGE,
date: this._date.clone(),
date: this._dates[index].clone(),
oldDate: oldDate

@@ -411,3 +438,3 @@ });

if (this.input !== undefined) {
this.input.val('' + (this.unset ? '' : this._date.format(this.actualFormat)));
this.input.val('' + (this.unset ? '' : this._dates[index].format(this.actualFormat)));
this.input.trigger('input');

@@ -482,4 +509,4 @@ }

DateTimePicker.prototype._dataToOptions = function _dataToOptions() {
var eData = this._element.data(),
dataOptions = {};
var eData = this._element.data();
var dataOptions = {};

@@ -685,7 +712,7 @@ if (eData.dateOptions && eData.dateOptions instanceof Object) {

DateTimePicker.prototype._initFormatting = function _initFormatting() {
var format = this._options.format || 'L LT';
var format = this._options.format || 'L LT',
self = this;
var self = this;
this.actualFormat = format.replace(/(\[[^\[]*])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) {
return self._date.localeData().longDateFormat(formatInput) || formatInput;
return self._dates[0].localeData().longDateFormat(formatInput) || formatInput; //todo taking the first date should be ok
});

@@ -717,2 +744,10 @@

DateTimePicker.prototype._getLastPickedDate = function _getLastPickedDate() {
return this._dates[this._getLastPickedDateIndex()];
};
DateTimePicker.prototype._getLastPickedDateIndex = function _getLastPickedDateIndex() {
return this._dates.length - 1;
};
//public

@@ -772,3 +807,4 @@

DateTimePicker.prototype.date = function date(newDate) {
DateTimePicker.prototype.date = function date(newDate, index) {
index = index || 0;
if (arguments.length === 0) {

@@ -778,3 +814,7 @@ if (this.unset) {

}
return this._date.clone();
if (this._options.allowMultidate) {
return this._dates.join(this._options.multidateSeparator);
} else {
return this._dates[index].clone();
}
}

@@ -786,3 +826,3 @@

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

@@ -855,3 +895,3 @@

this._update();
return;
return true;
}

@@ -874,3 +914,3 @@ if (!(dates instanceof Array)) {

this._update();
return;
return true;
}

@@ -893,3 +933,3 @@ if (!(dates instanceof Array)) {

this._update();
return;
return true;
}

@@ -911,11 +951,13 @@

if (this._options.useCurrent && !this._options.keepInvalid) {
var tries = 0;
while (!this._isValid(this._date, 'd')) {
this._date.add(1, 'd');
if (tries === 31) {
throw 'Tried 31 times to find a valid date';
for (var i = 0; i < this._dates.length; i++) {
var tries = 0;
while (!this._isValid(this._dates[i], 'd')) {
this._dates[i].add(1, 'd');
if (tries === 31) {
throw 'Tried 31 times to find a valid date';
}
tries++;
}
tries++;
this._setValue(this._dates[i], i);
}
this._setValue(this._date);
}

@@ -933,3 +975,3 @@ this._update();

this._update();
return;
return true;
}

@@ -952,4 +994,6 @@

this._options.maxDate = parsedDate;
if (this._options.useCurrent && !this._options.keepInvalid && this._date.isAfter(_maxDate)) {
this._setValue(this._options.maxDate);
for (var i = 0; i < this._dates.length; i++) {
if (this._options.useCurrent && !this._options.keepInvalid && this._dates[i].isAfter(_maxDate)) {
this._setValue(this._options.maxDate, i);
}
}

@@ -970,3 +1014,3 @@ if (this._viewDate.isAfter(parsedDate)) {

this._update();
return;
return true;
}

@@ -989,4 +1033,6 @@

this._options.minDate = parsedDate;
if (this._options.useCurrent && !this._options.keepInvalid && this._date.isBefore(_minDate)) {
this._setValue(this._options.minDate);
for (var i = 0; i < this._dates.length; i++) {
if (this._options.useCurrent && !this._options.keepInvalid && this._date[i].isBefore(_minDate)) {
this._setValue(this._options.minDate, i);
}
}

@@ -1005,3 +1051,3 @@ if (this._viewDate.isBefore(parsedDate)) {

this._options.defaultDate = false;
return;
return true;
}

@@ -1028,3 +1074,3 @@

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

@@ -1042,4 +1088,5 @@ };

this._options.locale = _locale;
this._date.locale(this._options.locale);
for (var i = 0; i < this._dates.length; i++) {
this._dates[i].locale(this._options.locale);
}
this._viewDate.locale(this._options.locale);

@@ -1092,3 +1139,3 @@

if (this._options.collapse === _collapse) {
return;
return true;
}

@@ -1256,3 +1303,3 @@ this._options.collapse = _collapse;

DateTimePicker.prototype.clear = function clear() {
this._setValue(null);
this._setValue(null); //todo
};

@@ -1331,3 +1378,3 @@

this._update();
return;
return true;
}

@@ -1349,3 +1396,3 @@ if (!(_disabledTimeIntervals instanceof Array)) {

this._update();
return;
return true;
}

@@ -1358,11 +1405,13 @@ if (!(hours instanceof Array)) {

if (this._options.useCurrent && !this._options.keepInvalid) {
var tries = 0;
while (!this._isValid(this._date, 'h')) {
this._date.add(1, 'h');
if (tries === 24) {
throw 'Tried 24 times to find a valid date';
for (var i = 0; i < this._dates.length; i++) {
var tries = 0;
while (!this._isValid(this._dates[i], 'h')) {
this._dates[i].add(1, 'h');
if (tries === 24) {
throw 'Tried 24 times to find a valid date';
}
tries++;
}
tries++;
this._setValue(this._dates[i], i);
}
this._setValue(this._date);
}

@@ -1380,3 +1429,3 @@ this._update();

this._update();
return;
return true;
}

@@ -1389,11 +1438,13 @@ if (!(hours instanceof Array)) {

if (this._options.useCurrent && !this._options.keepInvalid) {
var tries = 0;
while (!this._isValid(this._date, 'h')) {
this._date.add(1, 'h');
if (tries === 24) {
throw 'Tried 24 times to find a valid date';
for (var i = 0; i < this._dates.length; i++) {
var tries = 0;
while (!this._isValid(this._date[i], 'h')) {
this._date[i].add(1, 'h');
if (tries === 24) {
throw 'Tried 24 times to find a valid date';
}
tries++;
}
tries++;
this._setValue(this._dates[i], i);
}
this._setValue(this._date);
}

@@ -1409,4 +1460,4 @@ this._update();

if (!newDate) {
this._viewDate = this._date.clone();
return;
this._viewDate = (this._dates[0] || this.getMoment()).clone();
return true;
}

@@ -1422,2 +1473,22 @@

DateTimePicker.prototype.allowMultidate = function allowMultidate(_allowMultidate) {
if (typeof _allowMultidate !== 'boolean') {
throw new TypeError('allowMultidate() expects a boolean parameter');
}
this._options.allowMultidate = _allowMultidate;
};
DateTimePicker.prototype.multidateSeparator = function multidateSeparator(_multidateSeparator) {
if (arguments.length === 0) {
return this._options.multidateSeparator;
}
if (typeof _multidateSeparator !== 'string' || _multidateSeparator.length > 1) {
throw new TypeError('multidateSeparator expects a single character string parameter');
}
this._options.multidateSeparator = _multidateSeparator;
};
_createClass(DateTimePicker, null, [{

@@ -1424,0 +1495,0 @@ key: 'NAME',

@@ -1,1 +0,1 @@

function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),DateTimePicker=function(a){var b="datetimepicker",c="5.0.0-alpha.4",d=""+b,e="."+d,f=d+".",g=".data-api",h={DATA_TOGGLE:'[data-toggle="'+d+'"]'},i={INPUT:b+"-input"},j={CHANGE:"change"+e,BLUR:"blur"+e,KEYUP:"keyup"+e,KEYDOWN:"keydown"+e,FOCUS:"focus"+e,CLICK_DATA_API:"click"+e+g,UPDATE:f+"update",ERROR:f+"error",HIDE:f+"hide",SHOW:f+"show"},k={timeZone:"",format:!1,dayViewHeaderFormat:"MMMM YYYY",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:window.moment.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:"fa fa-clock-o",date:"fa fa-calendar",up:"fa fa-arrow-up",down:"fa fa-arrow-down",previous:"fa fa-chevron-left",next:"fa fa-chevron-right",today:"fa fa-calendar-check-o",clear:"fa fa-delete",close:"fa fa-times"},tooltips:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",prevMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",prevYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",prevDecade:"Previous Decade",nextDecade:"Next Decade",prevCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",togglePeriod:"Toggle Period",selectTime:"Select Time",selectDate:"Select Date"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:"days",toolbarPlacement:"default",buttons:{showToday:!1,showClear:!1,showClose:!1},widgetPositioning:{horizontal:"auto",vertical:"auto"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,keyBinds:{up:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")?this.date(a.clone().subtract(7,"d")):this.date(a.clone().add(this.stepping(),"m")),!0},down:function(){if(!this.widget)return this.show(),!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")?this.date(a.clone().add(7,"d")):this.date(a.clone().subtract(this.stepping(),"m")),!0},"control up":function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")?this.date(a.clone().subtract(1,"y")):this.date(a.clone().add(1,"h")),!0},"control down":function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")?this.date(a.clone().add(1,"y")):this.date(a.clone().subtract(1,"h")),!0},left:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")&&this.date(a.clone().subtract(1,"d")),!0},right:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")&&this.date(a.clone().add(1,"d")),!0},pageUp:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")&&this.date(a.clone().subtract(1,"M")),!0},pageDown:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")&&this.date(a.clone().add(1,"M")),!0},enter:function(){return this.hide(),!0},escape:function(){return!!this.widget&&(this.hide(),!0)},"control space":function(){return!!this.widget&&(this.widget.find(".timepicker").is(":visible")&&this.widget.find('.btn[data-action="togglePeriod"]').click(),!0)},t:function(){return this.date(this.getMoment()),!0},delete:function(){return!!this.widget&&(this.clear(),!0)}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1},l=[{CLASS_NAME:"days",NAV_FUNCTION:"M",NAV_STEP:1},{CLASS_NAME:"months",NAV_FUNCTION:"y",NAV_STEP:1},{CLASS_NAME:"years",NAV_FUNCTION:"y",NAV_STEP:10},{CLASS_NAME:"decades",NAV_FUNCTION:"y",NAV_STEP:100}],m={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t",delete:46,46:"delete"},n=["times","days","months","years","decades"],o=0,p={},q={},r=function(){function f(a,b){_classCallCheck(this,f),this._options=this._getOptions(b),this._element=a,this._date=null,this._viewDate=null,this.unset=!0,this.component=!1,this.widget=!1,this.use24Hours=null,this.actualFormat=null,this.parseFormats=null,this.currentViewMode=null,this._int()}return f.prototype._int=function(){var b=this._element.data("target-input");this._element.is("input")?this.input=this._element:void 0!==b&&("nearest"===b?this.input=this._element.find("input"):this.input=a(b)),this._date=this.getMoment(),this._viewDate=this._date.clone(),a.extend(!0,this._options,this._dataToOptions()),this.options(this._options),this._initFormatting(),void 0!==this.input&&this.input.is("input")&&0!==this.input.val().trim().length?this._setValue(this._parseInputDate(this.input.val().trim())):this._options.defaultDate&&void 0!==this.input&&void 0===this.input.attr("placeholder")&&this._setValue(this._options.defaultDate),this._options.inline&&this.show()},f.prototype._update=function(){this.widget&&(this._fillDate(),this._fillTime())},f.prototype._setValue=function(a){var b=this.unset?null:this._date;return a?(a=a.clone().locale(this._options.locale),this._hasTimeZone()&&a.tz(this._options.timeZone),1!==this._options.stepping&&a.minutes(Math.round(a.minutes()/this._options.stepping)*this._options.stepping).seconds(0),void(this._isValid(a)?(this._date=a,this._viewDate=a.clone(),void 0!==this.input&&(this.input.val(this._date.format(this.actualFormat)),this.input.trigger("input")),this._element.data("date",this._date.format(this.actualFormat)),this.unset=!1,this._update(),this._notifyEvent({type:f.Event.CHANGE,date:this._date.clone(),oldDate:b})):(this._options.keepInvalid?this._notifyEvent({type:f.Event.CHANGE,date:a,oldDate:b}):void 0!==this.input&&(this.input.val(""+(this.unset?"":this._date.format(this.actualFormat))),this.input.trigger("input")),this._notifyEvent({type:f.Event.ERROR,date:a,oldDate:b})))):(this.unset=!0,void 0!==this.input&&(this.input.val(""),this.input.trigger("input")),this._element.data("date",""),this._notifyEvent({type:f.Event.CHANGE,date:!1,oldDate:b}),void this._update())},f.prototype._change=function(b){var c=a(b.target).val().trim(),d=c?this._parseInputDate(c):null;return this._setValue(d),b.stopImmediatePropagation(),!1},f.prototype._getOptions=function(b){return b=a.extend(!0,{},k,b)},f.prototype._hasTimeZone=function(){return void 0!==window.moment.tz&&void 0!==this._options.timeZone&&null!==this._options.timeZone&&""!==this._options.timeZone},f.prototype._isEnabled=function(a){if("string"!=typeof a||a.length>1)throw new TypeError("isEnabled expects a single character string parameter");switch(a){case"y":return this.actualFormat.indexOf("Y")!==-1;case"M":return this.actualFormat.indexOf("M")!==-1;case"d":return this.actualFormat.toLowerCase().indexOf("d")!==-1;case"h":case"H":return this.actualFormat.toLowerCase().indexOf("h")!==-1;case"m":return this.actualFormat.indexOf("m")!==-1;case"s":return this.actualFormat.indexOf("s")!==-1;default:return!1}},f.prototype._hasTime=function(){return this._isEnabled("h")||this._isEnabled("m")||this._isEnabled("s")},f.prototype._hasDate=function(){return this._isEnabled("y")||this._isEnabled("M")||this._isEnabled("d")},f.prototype._dataToOptions=function(){var b=this._element.data(),c={};return b.dateOptions&&b.dateOptions instanceof Object&&(c=a.extend(!0,c,b.dateOptions)),a.each(this._options,function(a){var d="date"+a.charAt(0).toUpperCase()+a.slice(1);void 0!==b[d]?c[a]=b[d]:delete c[a]}),c},f.prototype._notifyEvent=function(a){a.type===f.Event.CHANGE&&a.date&&a.date.isSame(a.oldDate)||!a.date&&!a.oldDate||this._element.trigger(a)},f.prototype._viewUpdate=function(a){"y"===a&&(a="YYYY"),this._notifyEvent({type:f.Event.UPDATE,change:a,viewDate:this._viewDate.clone()})},f.prototype._showMode=function(a){this.widget&&(a&&(this.currentViewMode=Math.max(o,Math.min(3,this.currentViewMode+a))),this.widget.find(".datepicker > div").hide().filter(".datepicker-"+l[this.currentViewMode].CLASS_NAME).show())},f.prototype._isInDisabledDates=function(a){return this._options.disabledDates[a.format("YYYY-MM-DD")]===!0},f.prototype._isInEnabledDates=function(a){return this._options.enabledDates[a.format("YYYY-MM-DD")]===!0},f.prototype._isInDisabledHours=function(a){return this._options.disabledHours[a.format("H")]===!0},f.prototype._isInEnabledHours=function(a){return this._options.enabledHours[a.format("H")]===!0},f.prototype._isValid=function(b,c){if(!b.isValid())return!1;if(this._options.disabledDates&&"d"===c&&this._isInDisabledDates(b))return!1;if(this._options.enabledDates&&"d"===c&&!this._isInEnabledDates(b))return!1;if(this._options.minDate&&b.isBefore(this._options.minDate,c))return!1;if(this._options.maxDate&&b.isAfter(this._options.maxDate,c))return!1;if(this._options.daysOfWeekDisabled&&"d"===c&&this._options.daysOfWeekDisabled.indexOf(b.day())!==-1)return!1;if(this._options.disabledHours&&("h"===c||"m"===c||"s"===c)&&this._isInDisabledHours(b))return!1;if(this._options.enabledHours&&("h"===c||"m"===c||"s"===c)&&!this._isInEnabledHours(b))return!1;if(this._options.disabledTimeIntervals&&("h"===c||"m"===c||"s"===c)){var d=!1;if(a.each(this._options.disabledTimeIntervals,function(){if(b.isBetween(this[0],this[1]))return d=!0,!1}),d)return!1}return!0},f.prototype._parseInputDate=function(a){return void 0===this._options.parseInputDate?window.moment.isMoment(a)||(a=this.getMoment(a)):a=this._options.parseInputDate(a),a},f.prototype._keydown=function(a){var b=null,c=void 0,d=void 0,e=void 0,f=void 0,g=[],h={},i=a.which,j="p";p[i]=j;for(c in p)p.hasOwnProperty(c)&&p[c]===j&&(g.push(c),parseInt(c,10)!==i&&(h[c]=!0));for(c in this._options.keyBinds)if(this._options.keyBinds.hasOwnProperty(c)&&"function"==typeof this._options.keyBinds[c]&&(e=c.split(" "),e.length===g.length&&m[i]===e[e.length-1])){for(f=!0,d=e.length-2;d>=0;d--)if(!(m[e[d]]in h)){f=!1;break}if(f){b=this._options.keyBinds[c];break}}b&&b.call(this.widget)&&(a.stopPropagation(),a.preventDefault())},f.prototype._keyup=function(a){p[a.which]="r",q[a.which]&&(q[a.which]=!1,a.stopPropagation(),a.preventDefault())},f.prototype._indexGivenDates=function(b){var c={},d=this;return a.each(b,function(){var a=d._parseInputDate(this);a.isValid()&&(c[a.format("YYYY-MM-DD")]=!0)}),!!Object.keys(c).length&&c},f.prototype._indexGivenHours=function(b){var c={};return a.each(b,function(){c[this]=!0}),!!Object.keys(c).length&&c},f.prototype._initFormatting=function(){var a=this._options.format||"L LT",b=this;this.actualFormat=a.replace(/(\[[^\[]*])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){return b._date.localeData().longDateFormat(a)||a}),this.parseFormats=this._options.extraFormats?this._options.extraFormats.slice():[],this.parseFormats.indexOf(a)<0&&this.parseFormats.indexOf(this.actualFormat)<0&&this.parseFormats.push(this.actualFormat),this.use24Hours=this.actualFormat.toLowerCase().indexOf("a")<1&&this.actualFormat.replace(/\[.*?]/g,"").indexOf("h")<1,this._isEnabled("y")&&(o=2),this._isEnabled("M")&&(o=1),this._isEnabled("d")&&(o=0),this.currentViewMode=Math.max(o,this.currentViewMode),this.unset||this._setValue(this._date)},f.prototype.getMoment=function(a){var b=void 0;return b=void 0===a||null===a?window.moment():this._hasTimeZone()?window.moment.tz(a,this.parseFormats,this._options.useStrict,this._options.timeZone):window.moment(a,this.parseFormats,this._options.useStrict),this._hasTimeZone()&&b.tz(this._options.timeZone),b},f.prototype.toggle=function(){return this.widget?this.hide():this.show()},f.prototype.ignoreReadonly=function(a){if(0===arguments.length)return this._options.ignoreReadonly;if("boolean"!=typeof a)throw new TypeError("ignoreReadonly () expects a boolean parameter");this._options.ignoreReadonly=a},f.prototype.options=function(b){if(0===arguments.length)return a.extend(!0,{},this._options);if(!(b instanceof Object))throw new TypeError("options() this.options parameter should be an object");a.extend(!0,this._options,b);var c=this;a.each(this._options,function(a,b){void 0!==c[a]&&c[a](b)})},f.prototype.date=function(a){if(0===arguments.length)return this.unset?null:this._date.clone();if(!(null===a||"string"==typeof a||window.moment.isMoment(a)||a instanceof Date))throw new TypeError("date() parameter must be one of [null, string, moment or Date]");this._setValue(null===a?null:this._parseInputDate(a))},f.prototype.format=function(a){if(0===arguments.length)return this._options.format;if("string"!=typeof a&&("boolean"!=typeof a||a!==!1))throw new TypeError("format() expects a string or boolean:false parameter "+a);this._options.format=a,this.actualFormat&&this._initFormatting()},f.prototype.timeZone=function(a){if(0===arguments.length)return this._options.timeZone;if("string"!=typeof a)throw new TypeError("newZone() expects a string parameter");this._options.timeZone=a},f.prototype.dayViewHeaderFormat=function(a){if(0===arguments.length)return this._options.dayViewHeaderFormat;if("string"!=typeof a)throw new TypeError("dayViewHeaderFormat() expects a string parameter");this._options.dayViewHeaderFormat=a},f.prototype.extraFormats=function(a){if(0===arguments.length)return this._options.extraFormats;if(a!==!1&&!(a instanceof Array))throw new TypeError("extraFormats() expects an array or false parameter");this._options.extraFormats=a,this.parseFormats&&this._initFormatting()},f.prototype.disabledDates=function(b){if(0===arguments.length)return this._options.disabledDates?a.extend({},this._options.disabledDates):this._options.disabledDates;if(!b)return this._options.disabledDates=!1,void this._update();if(!(b instanceof Array))throw new TypeError("disabledDates() expects an array parameter");this._options.disabledDates=this._indexGivenDates(b),this._options.enabledDates=!1,this._update()},f.prototype.enabledDates=function(b){if(0===arguments.length)return this._options.enabledDates?a.extend({},this._options.enabledDates):this._options.enabledDates;if(!b)return this._options.enabledDates=!1,void this._update();if(!(b instanceof Array))throw new TypeError("enabledDates() expects an array parameter");this._options.enabledDates=this._indexGivenDates(b),this._options.disabledDates=!1,this._update()},f.prototype.daysOfWeekDisabled=function(a){if(0===arguments.length)return this._options.daysOfWeekDisabled.splice(0);if("boolean"==typeof a&&!a)return this._options.daysOfWeekDisabled=!1,void this._update();if(!(a instanceof Array))throw new TypeError("daysOfWeekDisabled() expects an array parameter");if(this._options.daysOfWeekDisabled=a.reduce(function(a,b){return b=parseInt(b,10),b>6||b<0||isNaN(b)?a:(a.indexOf(b)===-1&&a.push(b),a)},[]).sort(),this._options.useCurrent&&!this._options.keepInvalid){for(var b=0;!this._isValid(this._date,"d");){if(this._date.add(1,"d"),31===b)throw"Tried 31 times to find a valid date";b++}this._setValue(this._date)}this._update()},f.prototype.maxDate=function(a){if(0===arguments.length)return this._options.maxDate?this._options.maxDate.clone():this._options.maxDate;if("boolean"==typeof a&&a===!1)return this._options.maxDate=!1,void this._update();"string"==typeof a&&("now"!==a&&"moment"!==a||(a=this.getMoment()));var b=this._parseInputDate(a);if(!b.isValid())throw new TypeError("maxDate() Could not parse date parameter: "+a);if(this._options.minDate&&b.isBefore(this._options.minDate))throw new TypeError("maxDate() date parameter is before this.options.minDate: "+b.format(this.actualFormat));this._options.maxDate=b,this._options.useCurrent&&!this._options.keepInvalid&&this._date.isAfter(a)&&this._setValue(this._options.maxDate),this._viewDate.isAfter(b)&&(this._viewDate=b.clone().subtract(this._options.stepping,"m")),this._update()},f.prototype.minDate=function(a){if(0===arguments.length)return this._options.minDate?this._options.minDate.clone():this._options.minDate;if("boolean"==typeof a&&a===!1)return this._options.minDate=!1,void this._update();"string"==typeof a&&("now"!==a&&"moment"!==a||(a=this.getMoment()));var b=this._parseInputDate(a);if(!b.isValid())throw new TypeError("minDate() Could not parse date parameter: "+a);if(this._options.maxDate&&b.isAfter(this._options.maxDate))throw new TypeError("minDate() date parameter is after this.options.maxDate: "+b.format(this.actualFormat));this._options.minDate=b,this._options.useCurrent&&!this._options.keepInvalid&&this._date.isBefore(a)&&this._setValue(this._options.minDate),this._viewDate.isBefore(b)&&(this._viewDate=b.clone().add(this._options.stepping,"m")),this._update()},f.prototype.defaultDate=function(a){if(0===arguments.length)return this._options.defaultDate?this._options.defaultDate.clone():this._options.defaultDate;if(!a)return void(this._options.defaultDate=!1);"string"==typeof a&&(a="now"===a||"moment"===a?this.getMoment():this.getMoment(a));var b=this._parseInputDate(a);if(!b.isValid())throw new TypeError("defaultDate() Could not parse date parameter: "+a);if(!this._isValid(b))throw new TypeError("defaultDate() date passed is invalid according to component setup validations");this._options.defaultDate=b,(this._options.defaultDate&&this._options.inline||void 0!==this.input&&""===this.input.val().trim())&&this._setValue(this._options.defaultDate)},f.prototype.locale=function(a){if(0===arguments.length)return this._options.locale;if(!window.moment.localeData(a))throw new TypeError("locale() locale "+a+" is not loaded from moment locales!");this._options.locale=a,this._date.locale(this._options.locale),this._viewDate.locale(this._options.locale),this.actualFormat&&this._initFormatting(),this.widget&&(this.hide(),this.show())},f.prototype.stepping=function(a){return 0===arguments.length?this._options.stepping:(a=parseInt(a,10),(isNaN(a)||a<1)&&(a=1),void(this._options.stepping=a))},f.prototype.useCurrent=function(a){var b=["year","month","day","hour","minute"];if(0===arguments.length)return this._options.useCurrent;if("boolean"!=typeof a&&"string"!=typeof a)throw new TypeError("useCurrent() expects a boolean or string parameter");if("string"==typeof a&&b.indexOf(a.toLowerCase())===-1)throw new TypeError("useCurrent() expects a string parameter of "+b.join(", "));this._options.useCurrent=a},f.prototype.collapse=function(a){if(0===arguments.length)return this._options.collapse;if("boolean"!=typeof a)throw new TypeError("collapse() expects a boolean parameter");this._options.collapse!==a&&(this._options.collapse=a,this.widget&&(this.hide(),this.show()))},f.prototype.icons=function(b){if(0===arguments.length)return a.extend({},this._options.icons);if(!(b instanceof Object))throw new TypeError("icons() expects parameter to be an Object");a.extend(this._options.icons,b),this.widget&&(this.hide(),this.show())},f.prototype.tooltips=function(b){if(0===arguments.length)return a.extend({},this._options.tooltips);if(!(b instanceof Object))throw new TypeError("tooltips() expects parameter to be an Object");a.extend(this._options.tooltips,b),this.widget&&(this.hide(),this.show())},f.prototype.useStrict=function(a){if(0===arguments.length)return this._options.useStrict;if("boolean"!=typeof a)throw new TypeError("useStrict() expects a boolean parameter");this._options.useStrict=a},f.prototype.sideBySide=function(a){if(0===arguments.length)return this._options.sideBySide;if("boolean"!=typeof a)throw new TypeError("sideBySide() expects a boolean parameter");this._options.sideBySide=a,this.widget&&(this.hide(),this.show())},f.prototype.viewMode=function(a){if(0===arguments.length)return this._options.viewMode;if("string"!=typeof a)throw new TypeError("viewMode() expects a string parameter");if(f.ViewModes.indexOf(a)===-1)throw new TypeError("viewMode() parameter must be one of ("+f.ViewModes.join(", ")+") value");this._options.viewMode=a,this.currentViewMode=Math.max(f.ViewModes.indexOf(a)-1,f.MinViewModeNumber),this._showMode()},f.prototype.calendarWeeks=function(a){if(0===arguments.length)return this._options.calendarWeeks;if("boolean"!=typeof a)throw new TypeError("calendarWeeks() expects parameter to be a boolean value");this._options.calendarWeeks=a,this._update()},f.prototype.buttons=function(b){if(0===arguments.length)return a.extend({},this._options.buttons);if(!(b instanceof Object))throw new TypeError("buttons() expects parameter to be an Object");if(a.extend(this._options.buttons,b),"boolean"!=typeof this._options.buttons.showToday)throw new TypeError("buttons.showToday expects a boolean parameter");if("boolean"!=typeof this._options.buttons.showClear)throw new TypeError("buttons.showClear expects a boolean parameter");if("boolean"!=typeof this._options.buttons.showClose)throw new TypeError("buttons.showClose expects a boolean parameter");this.widget&&(this.hide(),this.show())},f.prototype.keepOpen=function(a){if(0===arguments.length)return this._options.keepOpen;if("boolean"!=typeof a)throw new TypeError("keepOpen() expects a boolean parameter");this._options.keepOpen=a},f.prototype.focusOnShow=function(a){if(0===arguments.length)return this._options.focusOnShow;if("boolean"!=typeof a)throw new TypeError("focusOnShow() expects a boolean parameter");this._options.focusOnShow=a},f.prototype.inline=function(a){if(0===arguments.length)return this._options.inline;if("boolean"!=typeof a)throw new TypeError("inline() expects a boolean parameter");this._options.inline=a},f.prototype.clear=function(){this._setValue(null)},f.prototype.keyBinds=function(a){return 0===arguments.length?this._options.keyBinds:void(this._options.keyBinds=a)},f.prototype.debug=function(a){if("boolean"!=typeof a)throw new TypeError("debug() expects a boolean parameter");this._options.debug=a},f.prototype.allowInputToggle=function(a){if(0===arguments.length)return this._options.allowInputToggle;if("boolean"!=typeof a)throw new TypeError("allowInputToggle() expects a boolean parameter");this._options.allowInputToggle=a},f.prototype.keepInvalid=function(a){if(0===arguments.length)return this._options.keepInvalid;if("boolean"!=typeof a)throw new TypeError("keepInvalid() expects a boolean parameter");this._options.keepInvalid=a},f.prototype.datepickerInput=function(a){if(0===arguments.length)return this._options.datepickerInput;if("string"!=typeof a)throw new TypeError("datepickerInput() expects a string parameter");this._options.datepickerInput=a},f.prototype.parseInputDate=function(a){if(0===arguments.length)return this._options.parseInputDate;if("function"!=typeof a)throw new TypeError("parseInputDate() should be as function");this._options.parseInputDate=a},f.prototype.disabledTimeIntervals=function(b){if(0===arguments.length)return this._options.disabledTimeIntervals?a.extend({},this._options.disabledTimeIntervals):this._options.disabledTimeIntervals;if(!b)return this._options.disabledTimeIntervals=!1,void this._update();if(!(b instanceof Array))throw new TypeError("disabledTimeIntervals() expects an array parameter");this._options.disabledTimeIntervals=b,this._update()},f.prototype.disabledHours=function(b){if(0===arguments.length)return this._options.disabledHours?a.extend({},this._options.disabledHours):this._options.disabledHours;if(!b)return this._options.disabledHours=!1,void this._update();if(!(b instanceof Array))throw new TypeError("disabledHours() expects an array parameter");if(this._options.disabledHours=this._indexGivenHours(b),this._options.enabledHours=!1,this._options.useCurrent&&!this._options.keepInvalid){for(var c=0;!this._isValid(this._date,"h");){if(this._date.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}this._setValue(this._date)}this._update()},f.prototype.enabledHours=function(b){if(0===arguments.length)return this._options.enabledHours?a.extend({},this._options.enabledHours):this._options.enabledHours;if(!b)return this._options.enabledHours=!1,void this._update();if(!(b instanceof Array))throw new TypeError("enabledHours() expects an array parameter");if(this._options.enabledHours=this._indexGivenHours(b),this._options.disabledHours=!1,this._options.useCurrent&&!this._options.keepInvalid){for(var c=0;!this._isValid(this._date,"h");){if(this._date.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}this._setValue(this._date)}this._update()},f.prototype.viewDate=function(a){if(0===arguments.length)return this._viewDate.clone();if(!a)return void(this._viewDate=this._date.clone());if(!("string"==typeof a||window.moment.isMoment(a)||a instanceof Date))throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");this._viewDate=this._parseInputDate(a),this._viewUpdate()},_createClass(f,null,[{key:"NAME",get:function(){return b}},{key:"VERSION",get:function(){return c}},{key:"DATA_KEY",get:function(){return d}},{key:"EVENT_KEY",get:function(){return e}},{key:"DATA_API_KEY",get:function(){return g}},{key:"DatePickerModes",get:function(){return l}},{key:"ViewModes",get:function(){return n}},{key:"MinViewModeNumber",get:function(){return o}},{key:"Event",get:function(){return j}},{key:"Selector",get:function(){return h}},{key:"Default",get:function(){return k}},{key:"ClassName",get:function(){return i}}]),f}();return r}(jQuery);
function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),DateTimePicker=function(a){var b="datetimepicker",c="5.0.0-alpha7",d=""+b,e="."+d,f=d+".",g=".data-api",h={DATA_TOGGLE:'[data-toggle="'+d+'"]'},i={INPUT:b+"-input"},j={CHANGE:"change"+e,BLUR:"blur"+e,KEYUP:"keyup"+e,KEYDOWN:"keydown"+e,FOCUS:"focus"+e,CLICK_DATA_API:"click"+e+g,UPDATE:f+"update",ERROR:f+"error",HIDE:f+"hide",SHOW:f+"show"},k={timeZone:"",format:!1,dayViewHeaderFormat:"MMMM YYYY",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:window.moment.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:"fa fa-clock-o",date:"fa fa-calendar",up:"fa fa-arrow-up",down:"fa fa-arrow-down",previous:"fa fa-chevron-left",next:"fa fa-chevron-right",today:"fa fa-calendar-check-o",clear:"fa fa-delete",close:"fa fa-times"},tooltips:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",prevMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",prevYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",prevDecade:"Previous Decade",nextDecade:"Next Decade",prevCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",togglePeriod:"Toggle Period",selectTime:"Select Time",selectDate:"Select Date"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:"days",toolbarPlacement:"default",buttons:{showToday:!1,showClear:!1,showClose:!1},widgetPositioning:{horizontal:"auto",vertical:"auto"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,keyBinds:{up:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")?this.date(a.clone().subtract(7,"d")):this.date(a.clone().add(this.stepping(),"m")),!0},down:function(){if(!this.widget)return this.show(),!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")?this.date(a.clone().add(7,"d")):this.date(a.clone().subtract(this.stepping(),"m")),!0},"control up":function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")?this.date(a.clone().subtract(1,"y")):this.date(a.clone().add(1,"h")),!0},"control down":function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")?this.date(a.clone().add(1,"y")):this.date(a.clone().subtract(1,"h")),!0},left:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")&&this.date(a.clone().subtract(1,"d")),!0},right:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")&&this.date(a.clone().add(1,"d")),!0},pageUp:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")&&this.date(a.clone().subtract(1,"M")),!0},pageDown:function(){if(!this.widget)return!1;var a=this._date||this.getMoment();return this.widget.find(".datepicker").is(":visible")&&this.date(a.clone().add(1,"M")),!0},enter:function(){return this.hide(),!0},escape:function(){return!!this.widget&&(this.hide(),!0)},"control space":function(){return!!this.widget&&(this.widget.find(".timepicker").is(":visible")&&this.widget.find('.btn[data-action="togglePeriod"]').click(),!0)},t:function(){return this.date(this.getMoment()),!0},delete:function(){return!!this.widget&&(this.clear(),!0)}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1,allowMultidate:!1,multidateSeparator:","},l=[{CLASS_NAME:"days",NAV_FUNCTION:"M",NAV_STEP:1},{CLASS_NAME:"months",NAV_FUNCTION:"y",NAV_STEP:1},{CLASS_NAME:"years",NAV_FUNCTION:"y",NAV_STEP:10},{CLASS_NAME:"decades",NAV_FUNCTION:"y",NAV_STEP:100}],m={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t",delete:46,46:"delete"},n=["times","days","months","years","decades"],o={},p={},q=0,r=function(){function f(a,b){_classCallCheck(this,f),this._options=this._getOptions(b),this._element=a,this._dates=[],this._datesFormatted=[],this._viewDate=null,this.unset=!0,this.component=!1,this.widget=!1,this.use24Hours=null,this.actualFormat=null,this.parseFormats=null,this.currentViewMode=null,this._int()}return f.prototype._int=function(){var b=this._element.data("target-input");this._element.is("input")?this.input=this._element:void 0!==b&&("nearest"===b?this.input=this._element.find("input"):this.input=a(b)),this._dates=[],this._dates[0]=this.getMoment(),this._viewDate=this.getMoment().clone(),a.extend(!0,this._options,this._dataToOptions()),this.options(this._options),this._initFormatting(),void 0!==this.input&&this.input.is("input")&&0!==this.input.val().trim().length?this._setValue(this._parseInputDate(this.input.val().trim())):this._options.defaultDate&&void 0!==this.input&&void 0===this.input.attr("placeholder")&&this._setValue(this._options.defaultDate),this._options.inline&&this.show()},f.prototype._update=function(){this.widget&&(this._fillDate(),this._fillTime())},f.prototype._setValue=function(a,b){var c=this.unset?null:this._dates[b],d="";if(!a)return this._options.allowMultidate&&1!==this._dates.length?(d=this._element.data("date")+",",d=d.replace(c.format(this.actualFormat)+",","").replace(",,","").replace(/,\s*$/,""),this._dates.splice(b,1),this._datesFormatted.splice(b,1)):this.unset=!0,void 0!==this.input&&(this.input.val(d),this.input.trigger("input")),this._element.data("date",d),this._notifyEvent({type:f.Event.CHANGE,date:!1,oldDate:c}),void this._update();if(a=a.clone().locale(this._options.locale),this._hasTimeZone()&&a.tz(this._options.timeZone),1!==this._options.stepping&&a.minutes(Math.round(a.minutes()/this._options.stepping)*this._options.stepping).seconds(0),this._isValid(a)){if(this._dates[b]=a,this._datesFormatted[b]=a.format("YYYY-MM-DD"),this._viewDate=a.clone(),this._options.allowMultidate&&this._dates.length>1){for(var e=0;e<this._dates.length;e++)d+=""+this._dates[e].format(this.actualFormat)+this._options.multidateSeparator;d=d.replace(/,\s*$/,"")}else d=this._dates[b].format(this.actualFormat);void 0!==this.input&&(this.input.val(d),this.input.trigger("input")),this._element.data("date",d),this.unset=!1,this._update(),this._notifyEvent({type:f.Event.CHANGE,date:this._dates[b].clone(),oldDate:c})}else this._options.keepInvalid?this._notifyEvent({type:f.Event.CHANGE,date:a,oldDate:c}):void 0!==this.input&&(this.input.val(""+(this.unset?"":this._dates[b].format(this.actualFormat))),this.input.trigger("input")),this._notifyEvent({type:f.Event.ERROR,date:a,oldDate:c})},f.prototype._change=function(b){var c=a(b.target).val().trim(),d=c?this._parseInputDate(c):null;return this._setValue(d),b.stopImmediatePropagation(),!1},f.prototype._getOptions=function(b){return b=a.extend(!0,{},k,b)},f.prototype._hasTimeZone=function(){return void 0!==window.moment.tz&&void 0!==this._options.timeZone&&null!==this._options.timeZone&&""!==this._options.timeZone},f.prototype._isEnabled=function(a){if("string"!=typeof a||a.length>1)throw new TypeError("isEnabled expects a single character string parameter");switch(a){case"y":return this.actualFormat.indexOf("Y")!==-1;case"M":return this.actualFormat.indexOf("M")!==-1;case"d":return this.actualFormat.toLowerCase().indexOf("d")!==-1;case"h":case"H":return this.actualFormat.toLowerCase().indexOf("h")!==-1;case"m":return this.actualFormat.indexOf("m")!==-1;case"s":return this.actualFormat.indexOf("s")!==-1;default:return!1}},f.prototype._hasTime=function(){return this._isEnabled("h")||this._isEnabled("m")||this._isEnabled("s")},f.prototype._hasDate=function(){return this._isEnabled("y")||this._isEnabled("M")||this._isEnabled("d")},f.prototype._dataToOptions=function(){var b=this._element.data(),c={};return b.dateOptions&&b.dateOptions instanceof Object&&(c=a.extend(!0,c,b.dateOptions)),a.each(this._options,function(a){var d="date"+a.charAt(0).toUpperCase()+a.slice(1);void 0!==b[d]?c[a]=b[d]:delete c[a]}),c},f.prototype._notifyEvent=function(a){a.type===f.Event.CHANGE&&a.date&&a.date.isSame(a.oldDate)||!a.date&&!a.oldDate||this._element.trigger(a)},f.prototype._viewUpdate=function(a){"y"===a&&(a="YYYY"),this._notifyEvent({type:f.Event.UPDATE,change:a,viewDate:this._viewDate.clone()})},f.prototype._showMode=function(a){this.widget&&(a&&(this.currentViewMode=Math.max(q,Math.min(3,this.currentViewMode+a))),this.widget.find(".datepicker > div").hide().filter(".datepicker-"+l[this.currentViewMode].CLASS_NAME).show())},f.prototype._isInDisabledDates=function(a){return this._options.disabledDates[a.format("YYYY-MM-DD")]===!0},f.prototype._isInEnabledDates=function(a){return this._options.enabledDates[a.format("YYYY-MM-DD")]===!0},f.prototype._isInDisabledHours=function(a){return this._options.disabledHours[a.format("H")]===!0},f.prototype._isInEnabledHours=function(a){return this._options.enabledHours[a.format("H")]===!0},f.prototype._isValid=function(b,c){if(!b.isValid())return!1;if(this._options.disabledDates&&"d"===c&&this._isInDisabledDates(b))return!1;if(this._options.enabledDates&&"d"===c&&!this._isInEnabledDates(b))return!1;if(this._options.minDate&&b.isBefore(this._options.minDate,c))return!1;if(this._options.maxDate&&b.isAfter(this._options.maxDate,c))return!1;if(this._options.daysOfWeekDisabled&&"d"===c&&this._options.daysOfWeekDisabled.indexOf(b.day())!==-1)return!1;if(this._options.disabledHours&&("h"===c||"m"===c||"s"===c)&&this._isInDisabledHours(b))return!1;if(this._options.enabledHours&&("h"===c||"m"===c||"s"===c)&&!this._isInEnabledHours(b))return!1;if(this._options.disabledTimeIntervals&&("h"===c||"m"===c||"s"===c)){var d=!1;if(a.each(this._options.disabledTimeIntervals,function(){if(b.isBetween(this[0],this[1]))return d=!0,!1}),d)return!1}return!0},f.prototype._parseInputDate=function(a){return void 0===this._options.parseInputDate?window.moment.isMoment(a)||(a=this.getMoment(a)):a=this._options.parseInputDate(a),a},f.prototype._keydown=function(a){var b=null,c=void 0,d=void 0,e=void 0,f=void 0,g=[],h={},i=a.which,j="p";o[i]=j;for(c in o)o.hasOwnProperty(c)&&o[c]===j&&(g.push(c),parseInt(c,10)!==i&&(h[c]=!0));for(c in this._options.keyBinds)if(this._options.keyBinds.hasOwnProperty(c)&&"function"==typeof this._options.keyBinds[c]&&(e=c.split(" "),e.length===g.length&&m[i]===e[e.length-1])){for(f=!0,d=e.length-2;d>=0;d--)if(!(m[e[d]]in h)){f=!1;break}if(f){b=this._options.keyBinds[c];break}}b&&b.call(this.widget)&&(a.stopPropagation(),a.preventDefault())},f.prototype._keyup=function(a){o[a.which]="r",p[a.which]&&(p[a.which]=!1,a.stopPropagation(),a.preventDefault())},f.prototype._indexGivenDates=function(b){var c={},d=this;return a.each(b,function(){var a=d._parseInputDate(this);a.isValid()&&(c[a.format("YYYY-MM-DD")]=!0)}),!!Object.keys(c).length&&c},f.prototype._indexGivenHours=function(b){var c={};return a.each(b,function(){c[this]=!0}),!!Object.keys(c).length&&c},f.prototype._initFormatting=function(){var a=this._options.format||"L LT",b=this;this.actualFormat=a.replace(/(\[[^\[]*])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){return b._dates[0].localeData().longDateFormat(a)||a}),this.parseFormats=this._options.extraFormats?this._options.extraFormats.slice():[],this.parseFormats.indexOf(a)<0&&this.parseFormats.indexOf(this.actualFormat)<0&&this.parseFormats.push(this.actualFormat),this.use24Hours=this.actualFormat.toLowerCase().indexOf("a")<1&&this.actualFormat.replace(/\[.*?]/g,"").indexOf("h")<1,this._isEnabled("y")&&(q=2),this._isEnabled("M")&&(q=1),this._isEnabled("d")&&(q=0),this.currentViewMode=Math.max(q,this.currentViewMode),this.unset||this._setValue(this._date)},f.prototype._getLastPickedDate=function(){return this._dates[this._getLastPickedDateIndex()]},f.prototype._getLastPickedDateIndex=function(){return this._dates.length-1},f.prototype.getMoment=function(a){var b=void 0;return b=void 0===a||null===a?window.moment():this._hasTimeZone()?window.moment.tz(a,this.parseFormats,this._options.useStrict,this._options.timeZone):window.moment(a,this.parseFormats,this._options.useStrict),this._hasTimeZone()&&b.tz(this._options.timeZone),b},f.prototype.toggle=function(){return this.widget?this.hide():this.show()},f.prototype.ignoreReadonly=function(a){if(0===arguments.length)return this._options.ignoreReadonly;if("boolean"!=typeof a)throw new TypeError("ignoreReadonly () expects a boolean parameter");this._options.ignoreReadonly=a},f.prototype.options=function(b){if(0===arguments.length)return a.extend(!0,{},this._options);if(!(b instanceof Object))throw new TypeError("options() this.options parameter should be an object");a.extend(!0,this._options,b);var c=this;a.each(this._options,function(a,b){void 0!==c[a]&&c[a](b)})},f.prototype.date=function(a,b){if(b=b||0,0===arguments.length)return this.unset?null:this._options.allowMultidate?this._dates.join(this._options.multidateSeparator):this._dates[b].clone();if(!(null===a||"string"==typeof a||window.moment.isMoment(a)||a instanceof Date))throw new TypeError("date() parameter must be one of [null, string, moment or Date]");this._setValue(null===a?null:this._parseInputDate(a),b)},f.prototype.format=function(a){if(0===arguments.length)return this._options.format;if("string"!=typeof a&&("boolean"!=typeof a||a!==!1))throw new TypeError("format() expects a string or boolean:false parameter "+a);this._options.format=a,this.actualFormat&&this._initFormatting()},f.prototype.timeZone=function(a){if(0===arguments.length)return this._options.timeZone;if("string"!=typeof a)throw new TypeError("newZone() expects a string parameter");this._options.timeZone=a},f.prototype.dayViewHeaderFormat=function(a){if(0===arguments.length)return this._options.dayViewHeaderFormat;if("string"!=typeof a)throw new TypeError("dayViewHeaderFormat() expects a string parameter");this._options.dayViewHeaderFormat=a},f.prototype.extraFormats=function(a){if(0===arguments.length)return this._options.extraFormats;if(a!==!1&&!(a instanceof Array))throw new TypeError("extraFormats() expects an array or false parameter");this._options.extraFormats=a,this.parseFormats&&this._initFormatting()},f.prototype.disabledDates=function(b){if(0===arguments.length)return this._options.disabledDates?a.extend({},this._options.disabledDates):this._options.disabledDates;if(!b)return this._options.disabledDates=!1,this._update(),!0;if(!(b instanceof Array))throw new TypeError("disabledDates() expects an array parameter");this._options.disabledDates=this._indexGivenDates(b),this._options.enabledDates=!1,this._update()},f.prototype.enabledDates=function(b){if(0===arguments.length)return this._options.enabledDates?a.extend({},this._options.enabledDates):this._options.enabledDates;if(!b)return this._options.enabledDates=!1,this._update(),!0;if(!(b instanceof Array))throw new TypeError("enabledDates() expects an array parameter");this._options.enabledDates=this._indexGivenDates(b),this._options.disabledDates=!1,this._update()},f.prototype.daysOfWeekDisabled=function(a){if(0===arguments.length)return this._options.daysOfWeekDisabled.splice(0);if("boolean"==typeof a&&!a)return this._options.daysOfWeekDisabled=!1,this._update(),!0;if(!(a instanceof Array))throw new TypeError("daysOfWeekDisabled() expects an array parameter");if(this._options.daysOfWeekDisabled=a.reduce(function(a,b){return b=parseInt(b,10),b>6||b<0||isNaN(b)?a:(a.indexOf(b)===-1&&a.push(b),a)},[]).sort(),this._options.useCurrent&&!this._options.keepInvalid)for(var b=0;b<this._dates.length;b++){for(var c=0;!this._isValid(this._dates[b],"d");){if(this._dates[b].add(1,"d"),31===c)throw"Tried 31 times to find a valid date";c++}this._setValue(this._dates[b],b)}this._update()},f.prototype.maxDate=function(a){if(0===arguments.length)return this._options.maxDate?this._options.maxDate.clone():this._options.maxDate;if("boolean"==typeof a&&a===!1)return this._options.maxDate=!1,this._update(),!0;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=this.getMoment()));var b=this._parseInputDate(a);if(!b.isValid())throw new TypeError("maxDate() Could not parse date parameter: "+a);if(this._options.minDate&&b.isBefore(this._options.minDate))throw new TypeError("maxDate() date parameter is before this.options.minDate: "+b.format(this.actualFormat));this._options.maxDate=b;for(var c=0;c<this._dates.length;c++)this._options.useCurrent&&!this._options.keepInvalid&&this._dates[c].isAfter(a)&&this._setValue(this._options.maxDate,c);this._viewDate.isAfter(b)&&(this._viewDate=b.clone().subtract(this._options.stepping,"m")),this._update()},f.prototype.minDate=function(a){if(0===arguments.length)return this._options.minDate?this._options.minDate.clone():this._options.minDate;if("boolean"==typeof a&&a===!1)return this._options.minDate=!1,this._update(),!0;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=this.getMoment()));var b=this._parseInputDate(a);if(!b.isValid())throw new TypeError("minDate() Could not parse date parameter: "+a);if(this._options.maxDate&&b.isAfter(this._options.maxDate))throw new TypeError("minDate() date parameter is after this.options.maxDate: "+b.format(this.actualFormat));this._options.minDate=b;for(var c=0;c<this._dates.length;c++)this._options.useCurrent&&!this._options.keepInvalid&&this._date[c].isBefore(a)&&this._setValue(this._options.minDate,c);this._viewDate.isBefore(b)&&(this._viewDate=b.clone().add(this._options.stepping,"m")),this._update()},f.prototype.defaultDate=function(a){if(0===arguments.length)return this._options.defaultDate?this._options.defaultDate.clone():this._options.defaultDate;if(!a)return this._options.defaultDate=!1,!0;"string"==typeof a&&(a="now"===a||"moment"===a?this.getMoment():this.getMoment(a));var b=this._parseInputDate(a);if(!b.isValid())throw new TypeError("defaultDate() Could not parse date parameter: "+a);if(!this._isValid(b))throw new TypeError("defaultDate() date passed is invalid according to component setup validations");this._options.defaultDate=b,(this._options.defaultDate&&this._options.inline||void 0!==this.input&&""===this.input.val().trim())&&this._setValue(this._options.defaultDate,0)},f.prototype.locale=function(a){if(0===arguments.length)return this._options.locale;if(!window.moment.localeData(a))throw new TypeError("locale() locale "+a+" is not loaded from moment locales!");for(var b=0;b<this._dates.length;b++)this._dates[b].locale(this._options.locale);this._viewDate.locale(this._options.locale),this.actualFormat&&this._initFormatting(),this.widget&&(this.hide(),this.show())},f.prototype.stepping=function(a){return 0===arguments.length?this._options.stepping:(a=parseInt(a,10),(isNaN(a)||a<1)&&(a=1),void(this._options.stepping=a))},f.prototype.useCurrent=function(a){var b=["year","month","day","hour","minute"];if(0===arguments.length)return this._options.useCurrent;if("boolean"!=typeof a&&"string"!=typeof a)throw new TypeError("useCurrent() expects a boolean or string parameter");if("string"==typeof a&&b.indexOf(a.toLowerCase())===-1)throw new TypeError("useCurrent() expects a string parameter of "+b.join(", "));this._options.useCurrent=a},f.prototype.collapse=function(a){if(0===arguments.length)return this._options.collapse;if("boolean"!=typeof a)throw new TypeError("collapse() expects a boolean parameter");return this._options.collapse===a||(this._options.collapse=a,void(this.widget&&(this.hide(),this.show())))},f.prototype.icons=function(b){if(0===arguments.length)return a.extend({},this._options.icons);if(!(b instanceof Object))throw new TypeError("icons() expects parameter to be an Object");a.extend(this._options.icons,b),this.widget&&(this.hide(),this.show())},f.prototype.tooltips=function(b){if(0===arguments.length)return a.extend({},this._options.tooltips);if(!(b instanceof Object))throw new TypeError("tooltips() expects parameter to be an Object");a.extend(this._options.tooltips,b),this.widget&&(this.hide(),this.show())},f.prototype.useStrict=function(a){if(0===arguments.length)return this._options.useStrict;if("boolean"!=typeof a)throw new TypeError("useStrict() expects a boolean parameter");this._options.useStrict=a},f.prototype.sideBySide=function(a){if(0===arguments.length)return this._options.sideBySide;if("boolean"!=typeof a)throw new TypeError("sideBySide() expects a boolean parameter");this._options.sideBySide=a,this.widget&&(this.hide(),this.show())},f.prototype.viewMode=function(a){if(0===arguments.length)return this._options.viewMode;if("string"!=typeof a)throw new TypeError("viewMode() expects a string parameter");if(f.ViewModes.indexOf(a)===-1)throw new TypeError("viewMode() parameter must be one of ("+f.ViewModes.join(", ")+") value");this._options.viewMode=a,this.currentViewMode=Math.max(f.ViewModes.indexOf(a)-1,f.MinViewModeNumber),this._showMode()},f.prototype.calendarWeeks=function(a){if(0===arguments.length)return this._options.calendarWeeks;if("boolean"!=typeof a)throw new TypeError("calendarWeeks() expects parameter to be a boolean value");this._options.calendarWeeks=a,this._update()},f.prototype.buttons=function(b){if(0===arguments.length)return a.extend({},this._options.buttons);if(!(b instanceof Object))throw new TypeError("buttons() expects parameter to be an Object");if(a.extend(this._options.buttons,b),"boolean"!=typeof this._options.buttons.showToday)throw new TypeError("buttons.showToday expects a boolean parameter");if("boolean"!=typeof this._options.buttons.showClear)throw new TypeError("buttons.showClear expects a boolean parameter");if("boolean"!=typeof this._options.buttons.showClose)throw new TypeError("buttons.showClose expects a boolean parameter");this.widget&&(this.hide(),this.show())},f.prototype.keepOpen=function(a){if(0===arguments.length)return this._options.keepOpen;if("boolean"!=typeof a)throw new TypeError("keepOpen() expects a boolean parameter");this._options.keepOpen=a},f.prototype.focusOnShow=function(a){if(0===arguments.length)return this._options.focusOnShow;if("boolean"!=typeof a)throw new TypeError("focusOnShow() expects a boolean parameter");this._options.focusOnShow=a},f.prototype.inline=function(a){if(0===arguments.length)return this._options.inline;if("boolean"!=typeof a)throw new TypeError("inline() expects a boolean parameter");this._options.inline=a},f.prototype.clear=function(){this._setValue(null)},f.prototype.keyBinds=function(a){return 0===arguments.length?this._options.keyBinds:void(this._options.keyBinds=a)},f.prototype.debug=function(a){if("boolean"!=typeof a)throw new TypeError("debug() expects a boolean parameter");this._options.debug=a},f.prototype.allowInputToggle=function(a){if(0===arguments.length)return this._options.allowInputToggle;if("boolean"!=typeof a)throw new TypeError("allowInputToggle() expects a boolean parameter");this._options.allowInputToggle=a},f.prototype.keepInvalid=function(a){if(0===arguments.length)return this._options.keepInvalid;if("boolean"!=typeof a)throw new TypeError("keepInvalid() expects a boolean parameter");this._options.keepInvalid=a},f.prototype.datepickerInput=function(a){if(0===arguments.length)return this._options.datepickerInput;if("string"!=typeof a)throw new TypeError("datepickerInput() expects a string parameter");this._options.datepickerInput=a},f.prototype.parseInputDate=function(a){if(0===arguments.length)return this._options.parseInputDate;if("function"!=typeof a)throw new TypeError("parseInputDate() should be as function");this._options.parseInputDate=a},f.prototype.disabledTimeIntervals=function(b){if(0===arguments.length)return this._options.disabledTimeIntervals?a.extend({},this._options.disabledTimeIntervals):this._options.disabledTimeIntervals;if(!b)return this._options.disabledTimeIntervals=!1,this._update(),!0;if(!(b instanceof Array))throw new TypeError("disabledTimeIntervals() expects an array parameter");this._options.disabledTimeIntervals=b,this._update()},f.prototype.disabledHours=function(b){if(0===arguments.length)return this._options.disabledHours?a.extend({},this._options.disabledHours):this._options.disabledHours;if(!b)return this._options.disabledHours=!1,this._update(),!0;if(!(b instanceof Array))throw new TypeError("disabledHours() expects an array parameter");if(this._options.disabledHours=this._indexGivenHours(b),this._options.enabledHours=!1,this._options.useCurrent&&!this._options.keepInvalid)for(var c=0;c<this._dates.length;c++){for(var d=0;!this._isValid(this._dates[c],"h");){if(this._dates[c].add(1,"h"),24===d)throw"Tried 24 times to find a valid date";d++}this._setValue(this._dates[c],c)}this._update()},f.prototype.enabledHours=function(b){if(0===arguments.length)return this._options.enabledHours?a.extend({},this._options.enabledHours):this._options.enabledHours;if(!b)return this._options.enabledHours=!1,this._update(),!0;if(!(b instanceof Array))throw new TypeError("enabledHours() expects an array parameter");if(this._options.enabledHours=this._indexGivenHours(b),this._options.disabledHours=!1,this._options.useCurrent&&!this._options.keepInvalid)for(var c=0;c<this._dates.length;c++){for(var d=0;!this._isValid(this._date[c],"h");){if(this._date[c].add(1,"h"),24===d)throw"Tried 24 times to find a valid date";d++}this._setValue(this._dates[c],c)}this._update()},f.prototype.viewDate=function(a){if(0===arguments.length)return this._viewDate.clone();if(!a)return this._viewDate=(this._dates[0]||this.getMoment()).clone(),!0;if(!("string"==typeof a||window.moment.isMoment(a)||a instanceof Date))throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");this._viewDate=this._parseInputDate(a),this._viewUpdate()},f.prototype.allowMultidate=function(a){if("boolean"!=typeof a)throw new TypeError("allowMultidate() expects a boolean parameter");this._options.allowMultidate=a},f.prototype.multidateSeparator=function(a){if(0===arguments.length)return this._options.multidateSeparator;if("string"!=typeof a||a.length>1)throw new TypeError("multidateSeparator expects a single character string parameter");this._options.multidateSeparator=a},_createClass(f,null,[{key:"NAME",get:function(){return b}},{key:"VERSION",get:function(){return c}},{key:"DATA_KEY",get:function(){return d}},{key:"EVENT_KEY",get:function(){return e}},{key:"DATA_API_KEY",get:function(){return g}},{key:"DatePickerModes",get:function(){return l}},{key:"ViewModes",get:function(){return n}},{key:"MinViewModeNumber",get:function(){return q}},{key:"Event",get:function(){return j}},{key:"Selector",get:function(){return h}},{key:"Default",get:function(){return k}},{key:"ClassName",get:function(){return i}}]),f}();return r}(jQuery);

@@ -51,3 +51,3 @@ {

},
"version": "5.0.0-alpha6",
"version": "5.0.0-alpha7",
"files": [

@@ -54,0 +54,0 @@ "build",

@@ -0,4 +1,6 @@

// ReSharper disable once InconsistentNaming
const DateTimePicker = ($ => {
// ReSharper disable InconsistentNaming
const NAME = 'datetimepicker',
VERSION = '5.0.0-alpha.4',
VERSION = '5.0.0-alpha7',
DATA_KEY = `${NAME}`,

@@ -228,3 +230,5 @@ EVENT_KEY = `.${DATA_KEY}`,

enabledHours: false,
viewDate: false
viewDate: false,
allowMultidate: false,
multidateSeparator: ','
},

@@ -278,8 +282,11 @@ DatePickerModes = [{

},
ViewModes = ['times', 'days', 'months', 'years', 'decades'];
let MinViewModeNumber = 0,
ViewModes = ['times', 'days', 'months', 'years', 'decades'],
keyState = {},
keyPressHandled = {};
let MinViewModeNumber = 0;
// ReSharper restore InconsistentNaming
// ReSharper disable once DeclarationHides
// ReSharper disable once InconsistentNaming
class DateTimePicker {

@@ -292,3 +299,4 @@ /** @namespace eData.dateOptions */

this._element = element;
this._date = null;
this._dates = [];
this._datesFormatted = [];
this._viewDate = null;

@@ -386,4 +394,5 @@ this.unset = true;

this._date = this.getMoment();
this._viewDate = this._date.clone();
this._dates = [];
this._dates[0] = this.getMoment();
this._viewDate = this.getMoment().clone();

@@ -414,13 +423,20 @@ $.extend(true, this._options, this._dataToOptions());

_setValue(targetMoment) {
const oldDate = this.unset ? null : this._date;
_setValue(targetMoment, index) {
const oldDate = this.unset ? null : this._dates[index];
let outpValue = '';
// case of calling setValue(null or false)
if (!targetMoment) {
this.unset = true;
if (!this._options.allowMultidate || this._dates.length === 1) {
this.unset = true;
} else {
outpValue = `${this._element.data('date')},`;
outpValue = outpValue.replace(`${oldDate.format(this.actualFormat)},`, '').replace(',,', '').replace(/,\s*$/, '');
this._dates.splice(index, 1);
this._datesFormatted.splice(index, 1);
}
if (this.input !== undefined) {
this.input.val('');
this.input.val(outpValue);
this.input.trigger('input');
}
this._element.data('date', '');
this._element.data('date', outpValue);
this._notifyEvent({

@@ -446,9 +462,19 @@ type: DateTimePicker.Event.CHANGE,

if (this._isValid(targetMoment)) {
this._date = targetMoment;
this._dates[index] = targetMoment;
this._datesFormatted[index] = targetMoment.format('YYYY-MM-DD');
this._viewDate = targetMoment.clone();
if (this._options.allowMultidate && this._dates.length > 1) {
for (let i = 0; i < this._dates.length; i++) {
outpValue += `${this._dates[i].format(this.actualFormat)}${this._options.multidateSeparator}`;
}
outpValue = outpValue.replace(/,\s*$/, '');
} else {
outpValue = this._dates[index].format(this.actualFormat);
}
if (this.input !== undefined) {
this.input.val(this._date.format(this.actualFormat));
this.input.val(outpValue);
this.input.trigger('input');
}
this._element.data('date', this._date.format(this.actualFormat));
this._element.data('date', outpValue);
this.unset = false;

@@ -458,3 +484,3 @@ this._update();

type: DateTimePicker.Event.CHANGE,
date: this._date.clone(),
date: this._dates[index].clone(),
oldDate: oldDate

@@ -465,3 +491,3 @@ });

if (this.input !== undefined) {
this.input.val(`${this.unset ? '' : this._date.format(this.actualFormat)}`);
this.input.val(`${this.unset ? '' : this._dates[index].format(this.actualFormat)}`);
this.input.trigger('input');

@@ -485,3 +511,3 @@ }

_change(e) {
let val = $(e.target).val().trim(),
const val = $(e.target).val().trim(),
parsedDate = val ? this._parseInputDate(val) : null;

@@ -535,4 +561,4 @@ this._setValue(parsedDate);

_dataToOptions() {
let eData = this._element.data(),
dataOptions = {};
const eData = this._element.data();
let dataOptions = {};

@@ -544,3 +570,3 @@ if (eData.dateOptions && eData.dateOptions instanceof Object) {

$.each(this._options, function (key) {
let attributeName = `date${key.charAt(0).toUpperCase()}${key.slice(1)}`; //todo data api key
const attributeName = `date${key.charAt(0).toUpperCase()}${key.slice(1)}`; //todo data api key
if (eData[attributeName] !== undefined) {

@@ -737,7 +763,6 @@ dataOptions[key] = eData[attributeName];

_initFormatting() {
const format = this._options.format || 'L LT';
const format = this._options.format || 'L LT', self = this;
let self = this;
this.actualFormat = format.replace(/(\[[^\[]*])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) {
return self._date.localeData().longDateFormat(formatInput) || formatInput;
return self._dates[0].localeData().longDateFormat(formatInput) || formatInput; //todo taking the first date should be ok
});

@@ -769,2 +794,10 @@

_getLastPickedDate() {
return this._dates[this._getLastPickedDateIndex()];
}
_getLastPickedDateIndex() {
return this._dates.length - 1;
}
//public

@@ -814,3 +847,3 @@ getMoment(d) {

$.extend(true, this._options, newOptions);
let self = this;
const self = this;
$.each(this._options, function (key, value) {

@@ -823,3 +856,4 @@ if (self[key] !== undefined) {

date(newDate) {
date(newDate, index) {
index = index || 0
if (arguments.length === 0) {

@@ -829,3 +863,8 @@ if (this.unset) {

}
return this._date.clone();
if (this._options.allowMultidate) {
return this._dates.join(this._options.multidateSeparator);
}
else {
return this._dates[index].clone();
}
}

@@ -837,3 +876,3 @@

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

@@ -906,3 +945,3 @@

this._update();
return;
return true;
}

@@ -925,3 +964,3 @@ if (!(dates instanceof Array)) {

this._update();
return;
return true;
}

@@ -944,3 +983,3 @@ if (!(dates instanceof Array)) {

this._update();
return;
return true;
}

@@ -962,11 +1001,13 @@

if (this._options.useCurrent && !this._options.keepInvalid) {
let tries = 0;
while (!this._isValid(this._date, 'd')) {
this._date.add(1, 'd');
if (tries === 31) {
throw 'Tried 31 times to find a valid date';
for (let i = 0; i < this._dates.length; i++) {
let tries = 0;
while (!this._isValid(this._dates[i], 'd')) {
this._dates[i].add(1, 'd');
if (tries === 31) {
throw 'Tried 31 times to find a valid date';
}
tries++;
}
tries++;
this._setValue(this._dates[i], i);
}
this._setValue(this._date);
}

@@ -984,3 +1025,3 @@ this._update();

this._update();
return;
return true;
}

@@ -1003,4 +1044,6 @@

this._options.maxDate = parsedDate;
if (this._options.useCurrent && !this._options.keepInvalid && this._date.isAfter(maxDate)) {
this._setValue(this._options.maxDate);
for (let i = 0; i < this._dates.length; i++) {
if (this._options.useCurrent && !this._options.keepInvalid && this._dates[i].isAfter(maxDate)) {
this._setValue(this._options.maxDate, i);
}
}

@@ -1021,3 +1064,3 @@ if (this._viewDate.isAfter(parsedDate)) {

this._update();
return;
return true;
}

@@ -1040,4 +1083,6 @@

this._options.minDate = parsedDate;
if (this._options.useCurrent && !this._options.keepInvalid && this._date.isBefore(minDate)) {
this._setValue(this._options.minDate);
for (let i = 0; i < this._dates.length; i++) {
if (this._options.useCurrent && !this._options.keepInvalid && this._date[i].isBefore(minDate)) {
this._setValue(this._options.minDate, i);
}
}

@@ -1056,3 +1101,3 @@ if (this._viewDate.isBefore(parsedDate)) {

this._options.defaultDate = false;
return;
return true;
}

@@ -1079,3 +1124,3 @@

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

@@ -1093,4 +1138,5 @@ }

this._options.locale = locale;
this._date.locale(this._options.locale);
for (let i = 0; i < this._dates.length; i++) {
this._dates[i].locale(this._options.locale);
}
this._viewDate.locale(this._options.locale);

@@ -1143,3 +1189,3 @@

if (this._options.collapse === collapse) {
return;
return true;
}

@@ -1307,3 +1353,3 @@ this._options.collapse = collapse;

clear() {
this._setValue(null);
this._setValue(null); //todo
}

@@ -1382,3 +1428,3 @@

this._update();
return;
return true;
}

@@ -1400,3 +1446,3 @@ if (!(disabledTimeIntervals instanceof Array)) {

this._update();
return;
return true;
}

@@ -1409,11 +1455,13 @@ if (!(hours instanceof Array)) {

if (this._options.useCurrent && !this._options.keepInvalid) {
let tries = 0;
while (!this._isValid(this._date, 'h')) {
this._date.add(1, 'h');
if (tries === 24) {
throw 'Tried 24 times to find a valid date';
for (let i = 0; i < this._dates.length; i++) {
let tries = 0;
while (!this._isValid(this._dates[i], 'h')) {
this._dates[i].add(1, 'h');
if (tries === 24) {
throw 'Tried 24 times to find a valid date';
}
tries++;
}
tries++;
this._setValue(this._dates[i], i);
}
this._setValue(this._date);
}

@@ -1431,3 +1479,3 @@ this._update();

this._update();
return;
return true;
}

@@ -1440,11 +1488,13 @@ if (!(hours instanceof Array)) {

if (this._options.useCurrent && !this._options.keepInvalid) {
let tries = 0;
while (!this._isValid(this._date, 'h')) {
this._date.add(1, 'h');
if (tries === 24) {
throw 'Tried 24 times to find a valid date';
for (let i = 0; i < this._dates.length; i++) {
let tries = 0;
while (!this._isValid(this._date[i], 'h')) {
this._date[i].add(1, 'h');
if (tries === 24) {
throw 'Tried 24 times to find a valid date';
}
tries++;
}
tries++;
this._setValue(this._dates[i], i);
}
this._setValue(this._date);
}

@@ -1460,4 +1510,4 @@ this._update();

if (!newDate) {
this._viewDate = this._date.clone();
return;
this._viewDate = (this._dates[0] || this.getMoment()).clone();
return true;
}

@@ -1472,2 +1522,22 @@

}
allowMultidate(allowMultidate) {
if (typeof allowMultidate !== 'boolean') {
throw new TypeError('allowMultidate() expects a boolean parameter');
}
this._options.allowMultidate = allowMultidate;
}
multidateSeparator(multidateSeparator) {
if (arguments.length === 0) {
return this._options.multidateSeparator;
}
if (typeof multidateSeparator !== 'string' || multidateSeparator.length > 1) {
throw new TypeError('multidateSeparator expects a single character string parameter');
}
this._options.multidateSeparator = multidateSeparator;
}
}

@@ -1474,0 +1544,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc