diff --git a/dist/css/datepicker.css b/dist/css/datepicker.css
index 9949400..ed9b8a7 100644
--- a/dist/css/datepicker.css
+++ b/dist/css/datepicker.css
@@ -414,11 +414,34 @@
font-size: 12px; }
.datepicker--time-current {
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
font-size: 16px;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
text-align: center; }
+ .datepicker--time-current input[type='text'] {
+ box-sizing: content-box;
+ border: none;
+ padding: 0 3px;
+ margin: 0;
+ outline: none;
+ box-shadow: none;
+ font-size: 16px;
+ width: 18px;
+ height: 23px; }
+ .datepicker--time-current > {
+ -webkit-flex: 1;
+ -ms-flex: 1;
+ flex: 1; }
.datepicker--time-row {
display: -webkit-flex;
diff --git a/dist/css/datepicker.min.css b/dist/css/datepicker.min.css
index 04006d9..c31a698 100644
--- a/dist/css/datepicker.min.css
+++ b/dist/css/datepicker.min.css
@@ -1 +1 @@
-.datepicker--cells{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.datepicker--cell{border-radius:4px;box-sizing:border-box;cursor:pointer;display:-webkit-flex;display:-ms-flexbox;display:flex;position:relative;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;height:32px;z-index:1}.datepicker--cell.-focus-{background:#f0f0f0}.datepicker--cell.-current-{color:#4EB5E6}.datepicker--cell.-current-.-focus-{color:#4a4a4a}.datepicker--cell.-current-.-in-range-{color:#4EB5E6}.datepicker--cell.-in-range-{background:rgba(92,196,239,.1);color:#4a4a4a;border-radius:0}.datepicker--cell.-in-range-.-focus-{background-color:rgba(92,196,239,.2)}.datepicker--cell.-disabled-{cursor:default;color:#aeaeae}.datepicker--cell.-disabled-.-focus-{color:#aeaeae}.datepicker--cell.-disabled-.-in-range-{color:#a1a1a1}.datepicker--cell.-disabled-.-current-.-focus-{color:#aeaeae}.datepicker--cell.-range-from-{border:1px solid rgba(92,196,239,.5);background-color:rgba(92,196,239,.1);border-radius:4px 0 0 4px}.datepicker--cell.-range-to-{border:1px solid rgba(92,196,239,.5);background-color:rgba(92,196,239,.1);border-radius:0 4px 4px 0}.datepicker--cell.-selected-,.datepicker--cell.-selected-.-current-{color:#fff;background:#5cc4ef}.datepicker--cell.-range-from-.-range-to-{border-radius:4px}.datepicker--cell.-selected-{border:none}.datepicker--cell.-selected-.-focus-{background:#45bced}.datepicker--cell:empty{cursor:default}.datepicker--days-names{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;margin:8px 0 3px}.datepicker--day-name{color:#FF9A19;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-flex:1;-ms-flex:1;flex:1;text-align:center;text-transform:uppercase;font-size:.8em}.datepicker--body,.datepicker-inline .datepicker--pointer{display:none}.datepicker--cell-day{width:14.28571%}.datepicker--cells-months{height:170px}.datepicker--cell-month{width:33.33%;height:25%}.datepicker--cells-years,.datepicker--years{height:170px}.datepicker--cell-year{width:25%;height:33.33%}.datepickers-container{position:absolute;left:0;top:0}.datepicker{background:#fff;border:1px solid #dbdbdb;box-shadow:0 4px 12px rgba(0,0,0,.15);border-radius:4px;box-sizing:content-box;font-family:Tahoma,sans-serif;font-size:14px;color:#4a4a4a;width:250px;position:absolute;left:-100000px;opacity:0;transition:opacity .3s ease,left 0s .3s,-webkit-transform .3s ease;transition:opacity .3s ease,transform .3s ease,left 0s .3s;transition:opacity .3s ease,transform .3s ease,left 0s .3s,-webkit-transform .3s ease;z-index:100}.datepicker.-from-top-{-webkit-transform:translateY(-8px);transform:translateY(-8px)}.datepicker.-from-right-{-webkit-transform:translateX(8px);transform:translateX(8px)}.datepicker.-from-bottom-{-webkit-transform:translateY(8px);transform:translateY(8px)}.datepicker.-from-left-{-webkit-transform:translateX(-8px);transform:translateX(-8px)}.datepicker.active{opacity:1;-webkit-transform:translate(0);transform:translate(0);transition:opacity .3s ease,left 0s 0s,-webkit-transform .3s ease;transition:opacity .3s ease,transform .3s ease,left 0s 0s;transition:opacity .3s ease,transform .3s ease,left 0s 0s,-webkit-transform .3s ease}.datepicker-inline .datepicker{border-color:#d7d7d7;box-shadow:none;position:static;left:auto;right:auto;opacity:1;-webkit-transform:none;transform:none}.datepicker--content{box-sizing:content-box;padding:4px}.datepicker--pointer{position:absolute;background:#fff;border-top:1px solid #dbdbdb;border-right:1px solid #dbdbdb;width:10px;height:10px;z-index:-1}.datepicker--nav-action:hover,.datepicker--nav-title:hover{background:#f0f0f0}.-top-center- .datepicker--pointer,.-top-left- .datepicker--pointer,.-top-right- .datepicker--pointer{top:calc(100% - 4px);-webkit-transform:rotate(135deg);transform:rotate(135deg)}.-right-bottom- .datepicker--pointer,.-right-center- .datepicker--pointer,.-right-top- .datepicker--pointer{right:calc(100% - 4px);-webkit-transform:rotate(225deg);transform:rotate(225deg)}.-bottom-center- .datepicker--pointer,.-bottom-left- .datepicker--pointer,.-bottom-right- .datepicker--pointer{bottom:calc(100% - 4px);-webkit-transform:rotate(315deg);transform:rotate(315deg)}.-left-bottom- .datepicker--pointer,.-left-center- .datepicker--pointer,.-left-top- .datepicker--pointer{left:calc(100% - 4px);-webkit-transform:rotate(45deg);transform:rotate(45deg)}.-bottom-left- .datepicker--pointer,.-top-left- .datepicker--pointer{left:10px}.-bottom-right- .datepicker--pointer,.-top-right- .datepicker--pointer{right:10px}.-bottom-center- .datepicker--pointer,.-top-center- .datepicker--pointer{left:calc(50% - 10px / 2)}.-left-top- .datepicker--pointer,.-right-top- .datepicker--pointer{top:10px}.-left-bottom- .datepicker--pointer,.-right-bottom- .datepicker--pointer{bottom:10px}.-left-center- .datepicker--pointer,.-right-center- .datepicker--pointer{top:calc(50% - 10px / 2)}.datepicker--body.active{display:block}.datepicker--nav{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;border-bottom:1px solid #efefef;min-height:32px;padding:4px}.datepicker--nav-action,.datepicker--nav-title{display:-webkit-flex;display:-ms-flexbox;display:flex;cursor:pointer;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.datepicker--nav-action{width:32px;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.datepicker--nav-action.-disabled-{visibility:hidden}.datepicker--nav-action svg{width:32px;height:32px}.datepicker--nav-action path{fill:none;stroke:#9c9c9c;stroke-width:2px}.datepicker--nav-title{border-radius:4px;padding:0 8px}.datepicker--nav-title i{font-style:normal;color:#9c9c9c;margin-left:5px}.datepicker--nav-title.-disabled-{cursor:default;background:0 0}.datepicker--buttons{display:-webkit-flex;display:-ms-flexbox;display:flex;padding:4px;border-top:1px solid #efefef}.datepicker--button{color:#4EB5E6;cursor:pointer;border-radius:4px;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:32px}.datepicker--button:hover{color:#4a4a4a;background:#f0f0f0}.datepicker--time{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;padding:0 4px 4px;position:relative}.datepicker--time-sliders{-webkit-flex:0 1 138px;-ms-flex:0 1 138px;flex:0 1 138px;-webkit-order:2;-ms-flex-order:2;order:2}.datepicker--time-label{display:none;font-size:12px}.datepicker--time-current{font-size:16px;-webkit-flex:1;-ms-flex:1;flex:1;text-align:center}.datepicker--time-row{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;font-size:11px;height:24px;background:linear-gradient(to right,#dedede,#dedede) left 50%/100% 1px no-repeat}.datepicker--time-row input[type=range]{background:0 0;cursor:pointer;-webkit-flex:1;-ms-flex:1;flex:1;height:100%;padding:0;margin:0;-webkit-appearance:none}.datepicker--time-row input[type=range]::-ms-tooltip{display:none}.datepicker--time-row input[type=range]:hover::-webkit-slider-thumb{border-color:#b8b8b8}.datepicker--time-row input[type=range]:focus{outline:0}.datepicker--time-row input[type=range]:focus::-webkit-slider-thumb{background:#5cc4ef;border-color:#5cc4ef}.datepicker--time-row input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;box-sizing:border-box;height:12px;width:12px;border-radius:3px;border:1px solid #dedede;background:#fff;margin-top:-6px;cursor:pointer;transition:background .2s}.datepicker--time-row input[type=range]::-moz-range-thumb{box-sizing:border-box;height:12px;width:12px;border-radius:3px;border:1px solid #dedede;background:#fff;margin-top:-6px;cursor:pointer;transition:background .2s}.datepicker--time-row input[type=range]::-ms-thumb{box-sizing:border-box;height:12px;width:12px;border-radius:3px;border:1px solid #dedede;background:#fff;margin-top:-6px;cursor:pointer;transition:background .2s}.datepicker--time-row input[type=range]::-webkit-slider-runnable-track{height:1px;cursor:pointer;background:0 0}.datepicker--time-row input[type=range]::-moz-range-track{height:1px;cursor:pointer;background:0 0}.datepicker--time-row input[type=range]::-ms-track{border:none;height:12px;cursor:pointer;color:transparent;background:0 0}.datepicker--time-row input[type=range]::-ms-fill-lower{background:0 0}.datepicker--time-row input[type=range]::-ms-fill-upper{background:0 0}.datepicker--time-row span{padding:0 12px}.datepicker--cell-day.-other-month-,.datepicker--cell-year.-other-decade-{color:#dedede}.datepicker--cell-day.-other-month-:hover,.datepicker--cell-year.-other-decade-:hover{color:#c5c5c5}.-disabled-.-focus-.datepicker--cell-day.-other-month-,.-disabled-.-focus-.datepicker--cell-year.-other-decade-{color:#dedede}.-selected-.datepicker--cell-day.-other-month-,.-selected-.datepicker--cell-year.-other-decade-{color:#fff;background:#a2ddf6}.-selected-.-focus-.datepicker--cell-day.-other-month-,.-selected-.-focus-.datepicker--cell-year.-other-decade-{background:#8ad5f4}.-in-range-.datepicker--cell-day.-other-month-,.-in-range-.datepicker--cell-year.-other-decade-{background-color:rgba(92,196,239,.1);color:#ccc}.-in-range-.-focus-.datepicker--cell-day.-other-month-,.-in-range-.-focus-.datepicker--cell-year.-other-decade-{background-color:rgba(92,196,239,.2)}.datepicker--cell-day.-other-month-:empty,.datepicker--cell-year.-other-decade-:empty{background:0 0;border:none}
\ No newline at end of file
+.datepicker--cells{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.datepicker--cell{border-radius:4px;box-sizing:border-box;cursor:pointer;display:-webkit-flex;display:-ms-flexbox;display:flex;position:relative;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;height:32px;z-index:1}.datepicker--cell.-focus-{background:#f0f0f0}.datepicker--cell.-current-{color:#4EB5E6}.datepicker--cell.-current-.-focus-{color:#4a4a4a}.datepicker--cell.-current-.-in-range-{color:#4EB5E6}.datepicker--cell.-in-range-{background:rgba(92,196,239,.1);color:#4a4a4a;border-radius:0}.datepicker--cell.-in-range-.-focus-{background-color:rgba(92,196,239,.2)}.datepicker--cell.-disabled-{cursor:default;color:#aeaeae}.datepicker--cell.-disabled-.-focus-{color:#aeaeae}.datepicker--cell.-disabled-.-in-range-{color:#a1a1a1}.datepicker--cell.-disabled-.-current-.-focus-{color:#aeaeae}.datepicker--cell.-range-from-{border:1px solid rgba(92,196,239,.5);background-color:rgba(92,196,239,.1);border-radius:4px 0 0 4px}.datepicker--cell.-range-to-{border:1px solid rgba(92,196,239,.5);background-color:rgba(92,196,239,.1);border-radius:0 4px 4px 0}.datepicker--cell.-selected-,.datepicker--cell.-selected-.-current-{color:#fff;background:#5cc4ef}.datepicker--cell.-range-from-.-range-to-{border-radius:4px}.datepicker--cell.-selected-{border:none}.datepicker--cell.-selected-.-focus-{background:#45bced}.datepicker--cell:empty{cursor:default}.datepicker--days-names{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;margin:8px 0 3px}.datepicker--day-name{color:#FF9A19;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-flex:1;-ms-flex:1;flex:1;text-align:center;text-transform:uppercase;font-size:.8em}.datepicker--body,.datepicker-inline .datepicker--pointer{display:none}.datepicker--cell-day{width:14.28571%}.datepicker--cells-months{height:170px}.datepicker--cell-month{width:33.33%;height:25%}.datepicker--cells-years,.datepicker--years{height:170px}.datepicker--cell-year{width:25%;height:33.33%}.datepickers-container{position:absolute;left:0;top:0}.datepicker{background:#fff;border:1px solid #dbdbdb;box-shadow:0 4px 12px rgba(0,0,0,.15);border-radius:4px;box-sizing:content-box;font-family:Tahoma,sans-serif;font-size:14px;color:#4a4a4a;width:250px;position:absolute;left:-100000px;opacity:0;transition:opacity .3s ease,left 0s .3s,-webkit-transform .3s ease;transition:opacity .3s ease,transform .3s ease,left 0s .3s;transition:opacity .3s ease,transform .3s ease,left 0s .3s,-webkit-transform .3s ease;z-index:100}.datepicker.-from-top-{-webkit-transform:translateY(-8px);transform:translateY(-8px)}.datepicker.-from-right-{-webkit-transform:translateX(8px);transform:translateX(8px)}.datepicker.-from-bottom-{-webkit-transform:translateY(8px);transform:translateY(8px)}.datepicker.-from-left-{-webkit-transform:translateX(-8px);transform:translateX(-8px)}.datepicker.active{opacity:1;-webkit-transform:translate(0);transform:translate(0);transition:opacity .3s ease,left 0s 0s,-webkit-transform .3s ease;transition:opacity .3s ease,transform .3s ease,left 0s 0s;transition:opacity .3s ease,transform .3s ease,left 0s 0s,-webkit-transform .3s ease}.datepicker-inline .datepicker{border-color:#d7d7d7;box-shadow:none;position:static;left:auto;right:auto;opacity:1;-webkit-transform:none;transform:none}.datepicker--content{box-sizing:content-box;padding:4px}.datepicker--pointer{position:absolute;background:#fff;border-top:1px solid #dbdbdb;border-right:1px solid #dbdbdb;width:10px;height:10px;z-index:-1}.datepicker--nav-action:hover,.datepicker--nav-title:hover{background:#f0f0f0}.-top-center- .datepicker--pointer,.-top-left- .datepicker--pointer,.-top-right- .datepicker--pointer{top:calc(100% - 4px);-webkit-transform:rotate(135deg);transform:rotate(135deg)}.-right-bottom- .datepicker--pointer,.-right-center- .datepicker--pointer,.-right-top- .datepicker--pointer{right:calc(100% - 4px);-webkit-transform:rotate(225deg);transform:rotate(225deg)}.-bottom-center- .datepicker--pointer,.-bottom-left- .datepicker--pointer,.-bottom-right- .datepicker--pointer{bottom:calc(100% - 4px);-webkit-transform:rotate(315deg);transform:rotate(315deg)}.-left-bottom- .datepicker--pointer,.-left-center- .datepicker--pointer,.-left-top- .datepicker--pointer{left:calc(100% - 4px);-webkit-transform:rotate(45deg);transform:rotate(45deg)}.-bottom-left- .datepicker--pointer,.-top-left- .datepicker--pointer{left:10px}.-bottom-right- .datepicker--pointer,.-top-right- .datepicker--pointer{right:10px}.-bottom-center- .datepicker--pointer,.-top-center- .datepicker--pointer{left:calc(50% - 10px / 2)}.-left-top- .datepicker--pointer,.-right-top- .datepicker--pointer{top:10px}.-left-bottom- .datepicker--pointer,.-right-bottom- .datepicker--pointer{bottom:10px}.-left-center- .datepicker--pointer,.-right-center- .datepicker--pointer{top:calc(50% - 10px / 2)}.datepicker--body.active{display:block}.datepicker--nav{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;border-bottom:1px solid #efefef;min-height:32px;padding:4px}.datepicker--nav-action,.datepicker--nav-title{display:-webkit-flex;display:-ms-flexbox;display:flex;cursor:pointer;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.datepicker--nav-action{width:32px;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.datepicker--nav-action.-disabled-{visibility:hidden}.datepicker--nav-action svg{width:32px;height:32px}.datepicker--nav-action path{fill:none;stroke:#9c9c9c;stroke-width:2px}.datepicker--nav-title{border-radius:4px;padding:0 8px}.datepicker--nav-title i{font-style:normal;color:#9c9c9c;margin-left:5px}.datepicker--nav-title.-disabled-{cursor:default;background:0 0}.datepicker--buttons{display:-webkit-flex;display:-ms-flexbox;display:flex;padding:4px;border-top:1px solid #efefef}.datepicker--button{color:#4EB5E6;cursor:pointer;border-radius:4px;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:32px}.datepicker--button:hover{color:#4a4a4a;background:#f0f0f0}.datepicker--time{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;padding:0 4px 4px;position:relative}.datepicker--time-sliders{-webkit-flex:0 1 138px;-ms-flex:0 1 138px;flex:0 1 138px;-webkit-order:2;-ms-flex-order:2;order:2}.datepicker--time-label{display:none;font-size:12px}.datepicker--time-current{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;font-size:16px;-webkit-flex:1;-ms-flex:1;flex:1;text-align:center}.datepicker--time-current input[type=text]{box-sizing:content-box;border:none;padding:0 3px;margin:0;outline:0;box-shadow:none;font-size:16px;width:18px;height:23px}.datepicker--time-current>{-webkit-flex:1;-ms-flex:1;flex:1}.datepicker--time-row{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;font-size:11px;height:24px;background:linear-gradient(to right,#dedede,#dedede) left 50%/100% 1px no-repeat}.datepicker--time-row input[type=range]{background:0 0;cursor:pointer;-webkit-flex:1;-ms-flex:1;flex:1;height:100%;padding:0;margin:0;-webkit-appearance:none}.datepicker--time-row input[type=range]::-ms-tooltip{display:none}.datepicker--time-row input[type=range]:hover::-webkit-slider-thumb{border-color:#b8b8b8}.datepicker--time-row input[type=range]:focus{outline:0}.datepicker--time-row input[type=range]:focus::-webkit-slider-thumb{background:#5cc4ef;border-color:#5cc4ef}.datepicker--time-row input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;box-sizing:border-box;height:12px;width:12px;border-radius:3px;border:1px solid #dedede;background:#fff;margin-top:-6px;cursor:pointer;transition:background .2s}.datepicker--time-row input[type=range]::-moz-range-thumb{box-sizing:border-box;height:12px;width:12px;border-radius:3px;border:1px solid #dedede;background:#fff;margin-top:-6px;cursor:pointer;transition:background .2s}.datepicker--time-row input[type=range]::-ms-thumb{box-sizing:border-box;height:12px;width:12px;border-radius:3px;border:1px solid #dedede;background:#fff;margin-top:-6px;cursor:pointer;transition:background .2s}.datepicker--time-row input[type=range]::-webkit-slider-runnable-track{height:1px;cursor:pointer;background:0 0}.datepicker--time-row input[type=range]::-moz-range-track{height:1px;cursor:pointer;background:0 0}.datepicker--time-row input[type=range]::-ms-track{border:none;height:12px;cursor:pointer;color:transparent;background:0 0}.datepicker--time-row input[type=range]::-ms-fill-lower{background:0 0}.datepicker--time-row input[type=range]::-ms-fill-upper{background:0 0}.datepicker--time-row span{padding:0 12px}.datepicker--cell-day.-other-month-,.datepicker--cell-year.-other-decade-{color:#dedede}.datepicker--cell-day.-other-month-:hover,.datepicker--cell-year.-other-decade-:hover{color:#c5c5c5}.-disabled-.-focus-.datepicker--cell-day.-other-month-,.-disabled-.-focus-.datepicker--cell-year.-other-decade-{color:#dedede}.-selected-.datepicker--cell-day.-other-month-,.-selected-.datepicker--cell-year.-other-decade-{color:#fff;background:#a2ddf6}.-selected-.-focus-.datepicker--cell-day.-other-month-,.-selected-.-focus-.datepicker--cell-year.-other-decade-{background:#8ad5f4}.-in-range-.datepicker--cell-day.-other-month-,.-in-range-.datepicker--cell-year.-other-decade-{background-color:rgba(92,196,239,.1);color:#ccc}.-in-range-.-focus-.datepicker--cell-day.-other-month-,.-in-range-.-focus-.datepicker--cell-year.-other-decade-{background-color:rgba(92,196,239,.2)}.datepicker--cell-day.-other-month-:empty,.datepicker--cell-year.-other-decade-:empty{background:0 0;border:none}
\ No newline at end of file
diff --git a/dist/js/datepicker.js b/dist/js/datepicker.js
index 3e14735..e8fe2ee 100644
--- a/dist/js/datepicker.js
+++ b/dist/js/datepicker.js
@@ -182,9 +182,11 @@ var Datepicker;
_bindEvents : function () {
this.$el.on(this.opts.showEvent + '.adp', this._onShowEvent.bind(this));
+ this.$el.on('mouseup.adp', this._onMouseUpEl.bind(this));
this.$el.on('blur.adp', this._onBlur.bind(this));
this.$el.on('input.adp', this._onInput.bind(this));
$(window).on('resize.adp', this._onResize.bind(this));
+ $('body').on('mouseup.adp', this._onMouseUpBody.bind(this));
},
_bindKeyboardEvents: function () {
@@ -950,11 +952,11 @@ var Datepicker;
_onMouseUpDatepicker: function (e) {
this.inFocus = false;
- this.$el.focus()
+ e.originalEvent.inFocus = true;
+ if (!e.originalEvent.timepickerFocus) this.$el.focus();
},
_onInput: function () {
- console.log(234);
var val = this.$el.val();
if (!val) {
@@ -968,6 +970,18 @@ var Datepicker;
}
},
+ _onMouseUpBody: function (e) {
+ if (e.originalEvent.inFocus) return;
+
+ if (this.visible && !this.inFocus) {
+ this.hide();
+ }
+ },
+
+ _onMouseUpEl: function (e) {
+ e.originalEvent.inFocus = true;
+ },
+
_onKeyDown: function (e) {
var code = e.which;
this._registerKey(code);
@@ -1727,8 +1741,13 @@ var Datepicker;
' ' +
' ' +
'' +
- '
#{hourValue}:#{minValue}
' +
- '';
+ '' +
+ ' ' +
+ ' : ' +
+ '
' +
+ '',
+ inputTimeout = 10;
+
datepicker.Timepicker = function (inst, opts) {
this.d = inst;
this.opts = opts;
@@ -1736,6 +1755,8 @@ var Datepicker;
var date = this.d.parsedDate;
this.minutes = date.minutes;
this.hours = date.hours;
+ this._minutes = date.minutes;
+ this._hours = date.hours;
this.init();
};
@@ -1750,6 +1771,11 @@ var Datepicker;
}
this.$ranges.on(input, this._onChangeRange.bind(this));
+ this.$currentInputs.on('mouseup', this._onMouseUpInput.bind(this));
+ this.$currentInputs.on('keydown', this._onKeyPressInput.bind(this));
+ this.$currentInputs.on('input', this._onInputInput.bind(this));
+ this.$currentInputs.on('blur', this._onBlurInput.bind(this));
+ this.$currentInputs.on('paste', this._onPasteInput.bind(this));
},
_buildHTML: function () {
@@ -1758,12 +1784,12 @@ var Datepicker;
hourMin: '00',
hourMax: '23',
hourStep: '1',
- hourValue: date.hours,
+ hourValue: date.fullHours,
hourLabel: 'Часы',
minMin: '00',
minMax: '59',
minStep: '1',
- minValue: date.minutes,
+ minValue: date.fullMinutes,
minLabel: 'Минуты'
},
_template = datepicker.template(template, data);
@@ -1771,6 +1797,9 @@ var Datepicker;
this.$timepicker = $(_template).appendTo(this.d.$datepicker);
this.$ranges = $('[type="range"]', this.$timepicker);
this.$currentTime = $('.datepicker--time-current', this.$timepicker);
+ this.$currentInputs = $('input[type="text"]', this.$timepicker);
+ this.$hoursText = $('[name="hours-current"]', this.$timepicker);
+ this.$minutesText = $('[name="minutes-current"]', this.$timepicker);
},
_render: function () {
@@ -1781,7 +1810,9 @@ var Datepicker;
var h = this.hours < 10 ? '0'+this.hours : this.hours,
m = this.minutes < 10 ? '0' + this.minutes : this.minutes,
html = h + ':' + m;
- this.$currentTime.html(html);
+
+ this.$hoursText.val(h);
+ this.$minutesText.val(m)
},
_onChangeRange: function (e) {
@@ -1792,6 +1823,103 @@ var Datepicker;
this[name] = value;
this._updateTime();
this.d._trigger('timeChange', [this.hours, this.minutes])
+ },
+
+ _onMouseUpInput: function (e) {
+ e.originalEvent.inFocus = true;
+ e.originalEvent.timepickerFocus = true;
+ },
+
+ _onKeyPressInput: function (e) {
+ var $el = $(e.target),
+ field = $el.data('field'),
+ max = $el.data('max'),
+ _this = this,
+ charCode = e.which,
+ action = $el.data('action'),
+ parsedVal,
+ initialValue = $el.val(),
+ val = $el.val();
+
+ setTimeout(function () {
+ val = $el.val();
+ parsedVal = parseInt(val);
+
+ if (parsedVal > max) {
+ $el.val(initialValue);
+ return;
+ }
+
+ if (val.length == 2) {
+ if (action == 'next' && charCode >= 48 && charCode <= 57) {
+ _this.$minutesText.focus().select();
+ }
+ }
+
+ if (!val.length) {
+ if (action == 'prev' && charCode == 8) {
+ _this.$hoursText.focus();
+
+ _this.$hoursText[0].selectionStart = 2;
+ _this.$hoursText[0].selectionEnd = 2;
+ }
+ }
+
+
+ }, inputTimeout);
+
+ return charCode >= 48 && charCode <= 57
+ || (charCode >= 37 && charCode <= 40)
+ || (charCode >= 96 && charCode <= 105)
+ || charCode == 17
+ || charCode == 13
+ || charCode == 46
+ || charCode == 8
+ || charCode == 9;
+ },
+
+ _onInputInput: function (e) {
+ var $el = $(e.target),
+ _this = this,
+ field = $el.data('field'),
+ max = $el.data('max'),
+ val = parseInt($el.val());
+
+ setTimeout(function () {
+ val = parseInt($el.val());
+
+ if (val > max) {
+ val = max;
+ $el.val(val);
+ } else if (!val) {
+ val = _this['_' + field]
+ }
+
+ _this[field] = val;
+ $('[name="' + field + '"]').val(val);
+ _this.d._trigger('timeChange',[_this.hours, _this.minutes])
+ }, inputTimeout)
+ },
+
+ _onBlurInput: function (e) {
+ var $el = $(e.target),
+ val = $el.val();
+
+ if (val.length == 1) {
+ val = '0' + val;
+ $el.val(val);
+ }
+ },
+
+ _onPasteInput: function (e) {
+ var $el = $(e.target),
+ val = $el.val(),
+ _this = this;
+
+ setTimeout(function () {
+ val = $el.val().replace(/\D/gi, '');
+ $el.val(val);
+ }, inputTimeout)
}
};
})(window, jQuery, Datepicker);
diff --git a/dist/js/datepicker.min.js b/dist/js/datepicker.min.js
index 48a7c6a..9fc5aef 100644
--- a/dist/js/datepicker.min.js
+++ b/dist/js/datepicker.min.js
@@ -1 +1 @@
-var Datepicker;!function(e,t,i){var s,a,n,h="datepicker",r=".datepicker-here",o=!1,c='',d={classes:"",inline:!1,language:"ru",startDate:new Date,firstDay:"",weekends:[6,0],dateFormat:"",altField:"",altFieldDateFormat:"@",toggleSelected:!0,keyboardNav:!0,position:"bottom left",offset:12,view:"days",minView:"days",showOtherMonths:!0,selectOtherMonths:!0,moveToOtherMonthsOnSelect:!0,showOtherYears:!0,selectOtherYears:!0,moveToOtherYearsOnSelect:!0,minDate:"",maxDate:"",disableNavWhenOutOfRange:!0,multipleDates:!1,multipleDatesSeparator:",",range:!1,todayButton:!1,clearButton:!1,showEvent:"focus",autoClose:!1,monthsFiled:"monthsShort",prevHtml:' ',nextHtml:' ',navTitles:{days:"MM, yyyy ",months:"yyyy",years:"yyyy1 - yyyy2"},timepicker:!1,timeFormat:"hh:ii",onSelect:"",onChangeMonth:"",onChangeYear:"",onChangeDecade:"",onChangeView:"",onRenderCell:""},l={ctrlRight:[17,39],ctrlUp:[17,38],ctrlLeft:[17,37],ctrlDown:[17,40],shiftRight:[16,39],shiftUp:[16,38],shiftLeft:[16,37],shiftDown:[16,40],altUp:[18,38],altRight:[18,39],altLeft:[18,37],altDown:[18,40],ctrlShiftUp:[16,17,38]};Datepicker=function(e,a){this.el=e,this.$el=t(e),this.opts=t.extend(!0,{},d,a,this.$el.data()),s==i&&(s=t("body")),this.opts.startDate||(this.opts.startDate=new Date),"INPUT"==this.el.nodeName&&(this.elIsInput=!0),this.opts.altField&&(this.$altField="string"==typeof this.opts.altField?t(this.opts.altField):this.opts.altField),this.inited=!1,this.visible=!1,this.silent=!1,this.currentDate=this.opts.startDate,this.currentView=this.opts.view,this._createShortCuts(),this.selectedDates=[],this.views={},this.keys=[],this.minRange="",this.maxRange="",this.init()},n=Datepicker,n.prototype={viewIndexes:["days","months","years"],init:function(){o||this.opts.inline||!this.elIsInput||this._buildDatepickersContainer(),this._buildBaseHtml(),this._defineLocale(this.opts.language),this._syncWithMinMaxDates(),this.elIsInput&&(this.opts.inline||(this._setPositionClasses(this.opts.position),this._bindEvents()),this.opts.keyboardNav&&this._bindKeyboardEvents(),this.$datepicker.on("mousedown",this._onMouseDownDatepicker.bind(this)),this.$datepicker.on("mouseup",this._onMouseUpDatepicker.bind(this))),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.views[this.currentView]=new Datepicker.Body(this,this.currentView,this.opts),this.views[this.currentView].show(),this.nav=new Datepicker.Navigation(this,this.opts),this.view=this.currentView,this.opts.timepicker&&(this.timepicker=new Datepicker.Timepicker(this,this.opts),this._bindTimepickerEvents()),this.$datepicker.on("mouseenter",".datepicker--cell",this._onMouseEnterCell.bind(this)),this.$datepicker.on("mouseleave",".datepicker--cell",this._onMouseLeaveCell.bind(this)),this.inited=!0},_createShortCuts:function(){this.minDate=this.opts.minDate?this.opts.minDate:new Date(-86399999136e5),this.maxDate=this.opts.maxDate?this.opts.maxDate:new Date(86399999136e5)},_bindEvents:function(){this.$el.on(this.opts.showEvent+".adp",this._onShowEvent.bind(this)),this.$el.on("blur.adp",this._onBlur.bind(this)),this.$el.on("input.adp",this._onInput.bind(this)),t(e).on("resize.adp",this._onResize.bind(this))},_bindKeyboardEvents:function(){this.$el.on("keydown.adp",this._onKeyDown.bind(this)),this.$el.on("keyup.adp",this._onKeyUp.bind(this)),this.$el.on("hotKey.adp",this._onHotKey.bind(this))},_bindTimepickerEvents:function(){this.$el.on("timeChange.adp",this._onTimeChange.bind(this))},isWeekend:function(e){return-1!==this.opts.weekends.indexOf(e)},_defineLocale:function(e){"string"==typeof e?(this.loc=Datepicker.language[e],this.loc||(console.warn("Can't find language \""+e+'" in Datepicker.language, will use "ru" instead'),this.loc=t.extend(!0,{},Datepicker.language.ru)),this.loc=t.extend(!0,{},Datepicker.language.ru,Datepicker.language[e])):this.loc=t.extend(!0,{},Datepicker.language.ru,e),this.opts.dateFormat&&(this.loc.dateFormat=this.opts.dateFormat),""!==this.opts.firstDay&&(this.loc.firstDay=this.opts.firstDay)},_buildDatepickersContainer:function(){o=!0,s.append('
'),a=t("#datepickers-container")},_buildBaseHtml:function(){var e,i=t('');e="INPUT"==this.el.nodeName?this.opts.inline?i.insertAfter(this.$el):a:i.appendTo(this.$el),this.$datepicker=t(c).appendTo(e),this.$content=t(".datepicker--content",this.$datepicker),this.$nav=t(".datepicker--nav",this.$datepicker)},_triggerOnChange:function(){if(!this.selectedDates.length)return this.opts.onSelect("","",this);var e,t=this.selectedDates,i=n.getParsedDate(t[0]),s=this,a=new Date(i.year,i.month,i.date);e=t.map(function(e){return s.formatDate(s.loc.dateFormat,e)}).join(this.opts.multipleDatesSeparator),(this.opts.multipleDates||this.opts.range)&&(a=t.map(function(e){var t=n.getParsedDate(e);return new Date(t.year,t.month,t.date)})),this.opts.onSelect(e,a,this)},next:function(){var e=this.parsedDate,t=this.opts;switch(this.view){case"days":this.date=new Date(e.year,e.month+1,1),t.onChangeMonth&&t.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(e.year+1,e.month,1),t.onChangeYear&&t.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(e.year+10,0,1),t.onChangeDecade&&t.onChangeDecade(this.curDecade)}},prev:function(){var e=this.parsedDate,t=this.opts;switch(this.view){case"days":this.date=new Date(e.year,e.month-1,1),t.onChangeMonth&&t.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(e.year-1,e.month,1),t.onChangeYear&&t.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(e.year-10,0,1),t.onChangeDecade&&t.onChangeDecade(this.curDecade)}},formatDate:function(e,t){t=t||this.date;var i=e,s=this.loc,a=n.getDecade(t),h=n.getParsedDate(t);switch(!0){case/@/.test(i):i=i.replace(/@/,t.getTime());case/dd/.test(i):i=i.replace(/\bdd\b/,h.fullDate);case/d/.test(i):i=i.replace(/\bd\b/,h.date);case/DD/.test(i):i=i.replace(/\bDD\b/,s.days[h.day]);case/D/.test(i):i=i.replace(/\bD\b/,s.daysShort[h.day]);case/mm/.test(i):i=i.replace(/\bmm\b/,h.fullMonth);case/m/.test(i):i=i.replace(/\bm\b/,h.month+1);case/MM/.test(i):i=i.replace(/\bMM\b/,this.loc.months[h.month]);case/M/.test(i):i=i.replace(/\bM\b/,s.monthsShort[h.month]);case/ii/.test(i):i=i.replace(/\bii\b/,h.fullMinutes);case/i/.test(i):i=i.replace(/\bi(?!>)\b/,h.minutes);case/hh/.test(i):i=i.replace(/\bhh\b/,h.fullHours);case/h/.test(i):i=i.replace(/\bh\b/,h.hours);case/yyyy/.test(i):i=i.replace(/\byyyy\b/,h.year);case/yyyy1/.test(i):i=i.replace(/\byyyy1\b/,a[0]);case/yyyy2/.test(i):i=i.replace(/\byyyy2\b/,a[1]);case/yy/.test(i):i=i.replace(/\byy\b/,h.year.toString().slice(-2))}return i},selectDate:function(e){var t=this,i=t.opts,s=t.parsedDate,a=t.selectedDates,n=a.length,h="";if(e instanceof Date){if(this.timepicker&&(e.setHours(this.timepicker.hours),e.setMinutes(this.timepicker.minutes)),"days"==t.view&&e.getMonth()!=s.month&&i.moveToOtherMonthsOnSelect&&(h=new Date(e.getFullYear(),e.getMonth(),1)),"years"==t.view&&e.getFullYear()!=s.year&&i.moveToOtherYearsOnSelect&&(h=new Date(e.getFullYear(),0,1)),h&&(t.silent=!0,t.date=h,t.silent=!1,t.nav._render()),i.multipleDates&&!i.range){if(n===i.multipleDates)return;t._isSelected(e)||t.selectedDates.push(e)}else i.range?2==n?(t.selectedDates=[e],t.minRange=e,t.maxRange=""):1==n?(t.selectedDates.push(e),t.maxRange?t.minRange=e:t.maxRange=e,t.selectedDates=[t.minRange,t.maxRange]):(t.selectedDates=[e],t.minRange=e):t.selectedDates=[e];t._setInputValue(),i.onSelect&&t._triggerOnChange(),i.autoClose&&(i.multipleDates||i.range?i.range&&2==t.selectedDates.length&&t.hide():t.hide()),t.views[this.currentView]._render()}},removeDate:function(e){var t=this.selectedDates,i=this;if(e instanceof Date)return t.some(function(s,a){return n.isSame(s,e)?(t.splice(a,1),i.selectedDates.length||(i.minRange="",i.maxRange=""),i.views[i.currentView]._render(),i._setInputValue(),i.opts.onSelect&&i._triggerOnChange(),!0):void 0})},today:function(){this.silent=!0,this.view=this.opts.minView,this.silent=!1,this.date=new Date},clear:function(){this.selectedDates=[],this.minRange="",this.maxRange="",this.views[this.currentView]._render(),this._setInputValue(),this.opts.onSelect&&this._triggerOnChange()},update:function(e,i){var s=arguments.length;return 2==s?this.opts[e]=i:1==s&&"object"==typeof e&&(this.opts=t.extend(!0,this.opts,e)),this._createShortCuts(),this._syncWithMinMaxDates(),this._defineLocale(this.opts.language),this.nav._addButtonsIfNeed(),this.nav._render(),this.views[this.currentView]._render(),this.elIsInput&&!this.opts.inline&&(this._setPositionClasses(this.opts.position),this.visible&&this.setPosition(this.opts.position)),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this},_syncWithMinMaxDates:function(){var e=this.date.getTime();this.silent=!0,this.minTime>e&&(this.date=this.minDate),this.maxTime
=this.minTime&&i<=this.maxTime,month:r>=this.minTime&&o<=this.maxTime,year:s.year>=a.year&&s.year<=h.year};return t?c[t]:c.day},_getDimensions:function(e){var t=e.offset();return{width:e.outerWidth(),height:e.outerHeight(),left:t.left,top:t.top}},_getDateFromCell:function(e){var t=this.parsedDate,s=e.data("year")||t.year,a=e.data("month")==i?t.month:e.data("month"),n=e.data("date")||1;return new Date(s,a,n)},_setPositionClasses:function(e){e=e.split(" ");var t=e[0],i=e[1],s="datepicker -"+t+"-"+i+"- -from-"+t+"-";this.visible&&(s+=" active"),this.$datepicker.removeAttr("class").addClass(s)},setPosition:function(e){e=e||this.opts.position;var t,i,s=this._getDimensions(this.$el),a=this._getDimensions(this.$datepicker),n=e.split(" "),h=this.opts.offset,r=n[0],o=n[1];switch(r){case"top":t=s.top-a.height-h;break;case"right":i=s.left+s.width+h;break;case"bottom":t=s.top+s.height+h;break;case"left":i=s.left-a.width-h}switch(o){case"top":t=s.top;break;case"right":i=s.left+s.width-a.width;break;case"bottom":t=s.top+s.height-a.height;break;case"left":i=s.left;break;case"center":/left|right/.test(r)?t=s.top+s.height/2-a.height/2:i=s.left+s.width/2-a.width/2}this.$datepicker.css({left:i,top:t})},show:function(){this.setPosition(this.opts.position),this.$datepicker.addClass("active"),this.visible=!0},hide:function(){this.$datepicker.removeClass("active").css({left:"-100000px"}),this.focused="",this.keys=[],this.inFocus=!1,this.visible=!1,this.$el.blur()},down:function(e){this._changeView(e,"down")},up:function(e){this._changeView(e,"up")},_changeView:function(e,t){e=e||this.focused||this.date;var i="up"==t?this.viewIndex+1:this.viewIndex-1;i>2&&(i=2),0>i&&(i=0),this.silent=!0,this.date=new Date(e.getFullYear(),e.getMonth(),1),this.silent=!1,this.view=this.viewIndexes[i]},_handleHotKey:function(e){var t,i,s,a=n.getParsedDate(this._getFocusedDate()),h=this.opts,r=!1,o=!1,c=!1,d=a.year,l=a.month,u=a.date;switch(e){case"ctrlRight":case"ctrlUp":l+=1,r=!0;break;case"ctrlLeft":case"ctrlDown":l-=1,r=!0;break;case"shiftRight":case"shiftUp":o=!0,d+=1;break;case"shiftLeft":case"shiftDown":o=!0,d-=1;break;case"altRight":case"altUp":c=!0,d+=10;break;case"altLeft":case"altDown":c=!0,d-=10;break;case"ctrlShiftUp":this.up()}s=n.getDaysCount(new Date(d,l)),i=new Date(d,l,u),u>s&&(u=s),i.getTime()this.maxTime&&(i=this.maxDate),this.focused=i,t=n.getParsedDate(i),r&&h.onChangeMonth&&h.onChangeMonth(t.month,t.year),o&&h.onChangeYear&&h.onChangeYear(t.year),c&&h.onChangeDecade&&h.onChangeDecade(this.curDecade)},_registerKey:function(e){var t=this.keys.some(function(t){return t==e});t||this.keys.push(e)},_unRegisterKey:function(e){var t=this.keys.indexOf(e);this.keys.splice(t,1)},_isHotKeyPressed:function(){var e,t=!1,i=this,s=this.keys.sort();for(var a in l)e=l[a],s.length==e.length&&e.every(function(e,t){return e==s[t]})&&(i._trigger("hotKey",a),t=!0);return t},_trigger:function(e,t){this.$el.trigger(e,t)},_focusNextCell:function(e,t){t=t||this.cellType;var i=n.getParsedDate(this._getFocusedDate()),s=i.year,a=i.month,h=i.date;if(!this._isHotKeyPressed()){switch(e){case 37:"day"==t?h-=1:"","month"==t?a-=1:"","year"==t?s-=1:"";break;case 38:"day"==t?h-=7:"","month"==t?a-=3:"","year"==t?s-=4:"";break;case 39:"day"==t?h+=1:"","month"==t?a+=1:"","year"==t?s+=1:"";break;case 40:"day"==t?h+=7:"","month"==t?a+=3:"","year"==t?s+=4:""}var r=new Date(s,a,h);r.getTime()this.maxTime&&(r=this.maxDate),this.focused=r}},_getFocusedDate:function(){var e=this.focused||this.selectedDates[this.selectedDates.length-1],t=this.parsedDate;if(!e)switch(this.view){case"days":e=new Date(t.year,t.month,(new Date).getDate());break;case"months":e=new Date(t.year,t.month,1);break;case"years":e=new Date(t.year,0,1)}return e},_getCell:function(e,t){t=t||this.cellType;var i,s=n.getParsedDate(e),a='.datepicker--cell[data-year="'+s.year+'"]';switch(t){case"month":a='[data-month="'+s.month+'"]';break;case"day":a+='[data-month="'+s.month+'"][data-date="'+s.date+'"]'}return i=this.views[this.currentView].$el.find(a),i.length?i:""},destroy:function(){var e=this;e.$el.off(".adp").data("datepicker",""),e.selectedDates=[],e.focused="",e.views={},e.keys=[],e.minRange="",e.maxRange="",e.opts.inline||!e.elIsInput?e.$datepicker.closest(".datepicker-inline").remove():e.$datepicker.remove()},_onShowEvent:function(){this.visible||this.show()},_onBlur:function(){!this.inFocus&&this.visible&&this.hide()},_onMouseDownDatepicker:function(e){this.inFocus=!0},_onMouseUpDatepicker:function(e){this.inFocus=!1,this.$el.focus()},_onInput:function(){console.log(234);var e=this.$el.val();e||this.clear()},_onResize:function(){this.visible&&this.setPosition()},_onKeyDown:function(e){var t=e.which;if(this._registerKey(t),t>=37&&40>=t&&(e.preventDefault(),this._focusNextCell(t)),13==t&&this.focused){if(this._getCell(this.focused).hasClass("-disabled-"))return;if(this.view!=this.opts.minView)this.down();else{var i=this._isSelected(this.focused,this.cellType);i?i&&this.opts.toggleSelected&&this.removeDate(this.focused):this.selectDate(this.focused)}}27==t&&this.hide()},_onKeyUp:function(e){var t=e.which;this._unRegisterKey(t)},_onHotKey:function(e,t){this._handleHotKey(t)},_onMouseEnterCell:function(e){var i=t(e.target).closest(".datepicker--cell"),s=this._getDateFromCell(i);this.silent=!0,this.focused&&(this.focused=""),i.addClass("-focus-"),this.focused=s,this.silent=!1,this.opts.range&&1==this.selectedDates.length&&(this.minRange=this.selectedDates[0],this.maxRange="",n.less(this.minRange,this.focused)&&(this.maxRange=this.minRange,this.minRange=""),this.views[this.currentView]._update())},_onMouseLeaveCell:function(e){var i=t(e.target).closest(".datepicker--cell");i.removeClass("-focus-"),this.silent=!0,this.focused="",this.silent=!1},_onTimeChange:function(e,t,i){var s=new Date,a=this.selectedDates,n=!1;a.length&&(n=!0,s=this.selectedDates[this.selectedDates.length-1]),s.setHours(t),s.setMinutes(i),n?(this.selectedDates[a.length-1]=s,this._setInputValue(),this._triggerOnChange()):this.selectDate(s)},set focused(e){if(!e&&this.focused){var t=this._getCell(this.focused);t.length&&t.removeClass("-focus-")}this._focused=e,this.opts.range&&1==this.selectedDates.length&&(this.minRange=this.selectedDates[0],this.maxRange="",n.less(this.minRange,this._focused)&&(this.maxRange=this.minRange,this.minRange="")),this.silent||(this.date=e)},get focused(){return this._focused},get parsedDate(){return n.getParsedDate(this.date)},set date(e){return e instanceof Date?(this.currentDate=e,this.inited&&!this.silent&&(this.views[this.view]._render(),this.nav._render(),this.visible&&this.elIsInput&&this.setPosition()),e):void 0},get date(){return this.currentDate},set view(e){return this.viewIndex=this.viewIndexes.indexOf(e),this.viewIndex<0?void 0:(this.prevView=this.currentView,this.currentView=e,this.inited&&(this.views[e]?this.views[e]._render():this.views[e]=new Datepicker.Body(this,e,this.opts),this.views[this.prevView].hide(),this.views[e].show(),this.nav._render(),this.opts.onChangeView&&this.opts.onChangeView(e),this.elIsInput&&this.visible&&this.setPosition()),e)},get view(){return this.currentView},get cellType(){return this.view.substring(0,this.view.length-1)},get minTime(){var e=n.getParsedDate(this.minDate);return new Date(e.year,e.month,e.date).getTime()},get maxTime(){var e=n.getParsedDate(this.maxDate);return new Date(e.year,e.month,e.date).getTime()},get curDecade(){return n.getDecade(this.date)}},n.getDaysCount=function(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()},n.getParsedDate=function(e){return{year:e.getFullYear(),month:e.getMonth(),fullMonth:e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1,date:e.getDate(),fullDate:e.getDate()<10?"0"+e.getDate():e.getDate(),day:e.getDay(),hours:e.getHours(),fullHours:e.getHours()<10?"0"+e.getHours():e.getHours(),minutes:e.getMinutes(),fullMinutes:e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}},n.getDecade=function(e){var t=10*Math.floor(e.getFullYear()/10);return[t,t+9]},n.template=function(e,t){return e.replace(/#\{([\w]+)\}/g,function(e,i){return t[i]||0===t[i]?t[i]:void 0})},n.isSame=function(e,t,i){if(!e||!t)return!1;var s=n.getParsedDate(e),a=n.getParsedDate(t),h=i?i:"day",r={day:s.date==a.date&&s.month==a.month&&s.year==a.year,month:s.month==a.month&&s.year==a.year,year:s.year==a.year};return r[h]},n.less=function(e,t,i){return e&&t?t.getTime()e.getTime():!1},Datepicker.language={ru:{days:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],daysShort:["Вос","Пон","Вто","Сре","Чет","Пят","Суб"],daysMin:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],today:"Сегодня",clear:"Очистить",dateFormat:"dd.mm.yyyy",firstDay:1}},t.fn[h]=function(e){return this.each(function(){if(t.data(this,h)){var i=t.data(this,h);i.opts=t.extend(!0,i.opts,e),i.update()}else t.data(this,h,new Datepicker(this,e))})},t(function(){t(r).datepicker()})}(window,jQuery),function(){var e={days:'',months:'',years:''},t=Datepicker;t.Body=function(e,t,i){this.d=e,this.type=t,this.opts=i,this.init()},t.Body.prototype={init:function(){this._buildBaseHtml(),this._render(),this._bindEvents()},_bindEvents:function(){this.$el.on("click",".datepicker--cell",$.proxy(this._onClickCell,this))},_buildBaseHtml:function(){this.$el=$(e[this.type]).appendTo(this.d.$content),this.$names=$(".datepicker--days-names",this.$el),this.$cells=$(".datepicker--cells",this.$el)},_getDayNamesHtml:function(e,t,i,s){return t=void 0!=t?t:e,i=i?i:"",s=void 0!=s?s:0,s>7?i:7==t?this._getDayNamesHtml(e,0,i,++s):(i+=''+this.d.loc.daysMin[t]+"
",this._getDayNamesHtml(e,++t,i,++s))},_getCellContents:function(e,i){var s="datepicker--cell datepicker--cell-"+i,a=new Date,n=this.d,h=n.opts,r=t.getParsedDate(e),o={},c=r.date;switch(h.onRenderCell&&(o=h.onRenderCell(e,i)||{},c=o.html?o.html:c,s+=o.classes?" "+o.classes:""),i){case"day":n.isWeekend(r.day)&&(s+=" -weekend-"),r.month!=this.d.parsedDate.month&&(s+=" -other-month-",h.selectOtherMonths||(s+=" -disabled-"),h.showOtherMonths||(c=""));break;case"month":c=n.loc[n.opts.monthsFiled][r.month];break;case"year":var d=n.curDecade;c=r.year,(r.yeard[1])&&(s+=" -other-decade-",h.selectOtherYears||(s+=" -disabled-"),h.showOtherYears||(c=""))}return h.onRenderCell&&(o=h.onRenderCell(e,i)||{},c=o.html?o.html:c,s+=o.classes?" "+o.classes:""),h.range&&(t.isSame(n.minRange,e,i)&&(s+=" -range-from-"),t.isSame(n.maxRange,e,i)&&(s+=" -range-to-"),1==n.selectedDates.length&&n.focused?((t.bigger(n.minRange,e)&&t.less(n.focused,e)||t.less(n.maxRange,e)&&t.bigger(n.focused,e))&&(s+=" -in-range-"),t.less(n.maxRange,e)&&t.isSame(n.focused,e)&&(s+=" -range-from-"),t.bigger(n.minRange,e)&&t.isSame(n.focused,e)&&(s+=" -range-to-")):2==n.selectedDates.length&&t.bigger(n.minRange,e)&&t.less(n.maxRange,e)&&(s+=" -in-range-")),t.isSame(a,e,i)&&(s+=" -current-"),n.focused&&t.isSame(e,n.focused,i)&&(s+=" -focus-"),n._isSelected(e,i)&&(s+=" -selected-"),(!n._isInRange(e,i)||o.disabled)&&(s+=" -disabled-"),{html:c,classes:s}},_getDaysHtml:function(e){var i=t.getDaysCount(e),s=new Date(e.getFullYear(),e.getMonth(),1).getDay(),a=new Date(e.getFullYear(),e.getMonth(),i).getDay(),n=s-this.d.loc.firstDay,h=6-a+this.d.loc.firstDay;n=0>n?n+7:n,h=h>6?h-7:h;for(var r,o,c=-n+1,d="",l=c,u=i+h;u>=l;l++)o=e.getFullYear(),r=e.getMonth(),d+=this._getDayHtml(new Date(o,r,l));return d},_getDayHtml:function(e){var t=this._getCellContents(e,"day");return''+t.html+"
"},_getMonthsHtml:function(e){for(var i="",s=t.getParsedDate(e),a=0;12>a;)i+=this._getMonthHtml(new Date(s.year,a)),a++;return i},_getMonthHtml:function(e){var t=this._getCellContents(e,"month");return''+t.html+"
"},_getYearsHtml:function(e){var i=(t.getParsedDate(e),t.getDecade(e)),s=i[0]-1,a="",n=s;for(n;n<=i[1]+1;n++)a+=this._getYearHtml(new Date(n,0));return a},_getYearHtml:function(e){var t=this._getCellContents(e,"year");return''+t.html+"
"},_renderTypes:{days:function(){var e=this._getDayNamesHtml(this.d.loc.firstDay),t=this._getDaysHtml(this.d.currentDate);this.$cells.html(t),this.$names.html(e)},months:function(){var e=this._getMonthsHtml(this.d.currentDate);this.$cells.html(e)},years:function(){var e=this._getYearsHtml(this.d.currentDate);this.$cells.html(e)}},_render:function(){this._renderTypes[this.type].bind(this)()},_update:function(){var e,t,i,s=$(".datepicker--cell",this.$cells),a=this;s.each(function(s,n){t=$(this),i=a.d._getDateFromCell($(this)),e=a._getCellContents(i,a.d.cellType),t.attr("class",e.classes)})},show:function(){this.$el.addClass("active"),this.acitve=!0},hide:function(){this.$el.removeClass("active"),this.active=!1},_handleClick:function(e){var t=e.data("date")||1,i=e.data("month")||0,s=e.data("year")||this.d.parsedDate.year;if(this.d.view!=this.opts.minView)return void this.d.down(new Date(s,i,t));var a=new Date(s,i,t),n=this.d._isSelected(a,this.d.cellType);n?n&&this.opts.toggleSelected&&this.d.removeDate(a):this.d.selectDate(a)},_onClickCell:function(e){var t=$(e.target).closest(".datepicker--cell");t.hasClass("-disabled-")||this._handleClick.bind(this)(t)}}}(),function(){var e='#{prevHtml}
#{title}
#{nextHtml}
',t='
',i='#{label} ';Datepicker.Navigation=function(e,t){this.d=e,this.opts=t,this.$buttonsContainer="",this.init()},Datepicker.Navigation.prototype={init:function(){this._buildBaseHtml(),this._bindEvents()},_bindEvents:function(){this.d.$nav.on("click",".datepicker--nav-action",$.proxy(this._onClickNavButton,this)),this.d.$nav.on("click",".datepicker--nav-title",$.proxy(this._onClickNavTitle,this)),this.d.$datepicker.on("click",".datepicker--button",$.proxy(this._onClickNavButton,this))},_buildBaseHtml:function(){this._render(),this._addButtonsIfNeed()},_addButtonsIfNeed:function(){this.opts.todayButton&&this._addButton("today"),this.opts.clearButton&&this._addButton("clear")},_render:function(){var t=this._getTitle(this.d.currentDate),i=Datepicker.template(e,$.extend({title:t},this.opts));this.d.$nav.html(i),"years"==this.d.view&&$(".datepicker--nav-title",this.d.$nav).addClass("-disabled-"),this.setNavStatus()},_getTitle:function(e){return this.d.formatDate(this.opts.navTitles[this.d.view],e)},_addButton:function(e){this.$buttonsContainer.length||this._addButtonsContainer();var t={action:e,label:this.d.loc[e]},s=Datepicker.template(i,t);$("[data-action="+e+"]",this.$buttonsContainer).length||this.$buttonsContainer.append(s)},_addButtonsContainer:function(){this.d.$datepicker.append(t),this.$buttonsContainer=$(".datepicker--buttons",this.d.$datepicker)},setNavStatus:function(){if((this.opts.minDate||this.opts.maxDate)&&this.opts.disableNavWhenOutOfRange){var e=this.d.parsedDate,t=e.month,i=e.year,s=e.date;switch(this.d.view){case"days":this.d._isInRange(new Date(i,t-1,s),"month")||this._disableNav("prev"),this.d._isInRange(new Date(i,t+1,s),"month")||this._disableNav("next");break;case"months":this.d._isInRange(new Date(i-1,t,s),"year")||this._disableNav("prev"),this.d._isInRange(new Date(i+1,t,s),"year")||this._disableNav("next");break;case"years":this.d._isInRange(new Date(i-10,t,s),"year")||this._disableNav("prev"),this.d._isInRange(new Date(i+10,t,s),"year")||this._disableNav("next")}}},_disableNav:function(e){$('[data-action="'+e+'"]',this.d.$nav).addClass("-disabled-")},_activateNav:function(e){$('[data-action="'+e+'"]',this.d.$nav).removeClass("-disabled-")},_onClickNavButton:function(e){var t=$(e.target).closest("[data-action]"),i=t.data("action");this.d[i]()},_onClickNavTitle:function(e){return $(e.target).hasClass("-disabled-")?void 0:"days"==this.d.view?this.d.view="months":void(this.d.view="years")}}}(),function(e,t,i){var s='';i.Timepicker=function(e,t){this.d=e,this.opts=t;var i=this.d.parsedDate;this.minutes=i.minutes,this.hours=i.hours,this.init()},i.Timepicker.prototype={init:function(){var e="input";this._buildHTML(),navigator.userAgent.match(/trident/gi)&&(e="change"),this.$ranges.on(e,this._onChangeRange.bind(this))},_buildHTML:function(){var e=this.d.parsedDate,a={hourMin:"00",hourMax:"23",hourStep:"1",hourValue:e.hours,hourLabel:"Часы",minMin:"00",minMax:"59",minStep:"1",minValue:e.minutes,minLabel:"Минуты"},n=i.template(s,a);this.$timepicker=t(n).appendTo(this.d.$datepicker),this.$ranges=t('[type="range"]',this.$timepicker),this.$currentTime=t(".datepicker--time-current",this.$timepicker)},_render:function(){},_updateTime:function(){var e=this.hours<10?"0"+this.hours:this.hours,t=this.minutes<10?"0"+this.minutes:this.minutes,i=e+":"+t;this.$currentTime.html(i)},_onChangeRange:function(e){var i=t(e.target),s=i.val(),a=i.attr("name");this[a]=s,this._updateTime(),this.d._trigger("timeChange",[this.hours,this.minutes])}}}(window,jQuery,Datepicker);
\ No newline at end of file
+var Datepicker;!function(t,e,i){var s,a,n,h="datepicker",r=".datepicker-here",o=!1,c='',l={classes:"",inline:!1,language:"ru",startDate:new Date,firstDay:"",weekends:[6,0],dateFormat:"",altField:"",altFieldDateFormat:"@",toggleSelected:!0,keyboardNav:!0,position:"bottom left",offset:12,view:"days",minView:"days",showOtherMonths:!0,selectOtherMonths:!0,moveToOtherMonthsOnSelect:!0,showOtherYears:!0,selectOtherYears:!0,moveToOtherYearsOnSelect:!0,minDate:"",maxDate:"",disableNavWhenOutOfRange:!0,multipleDates:!1,multipleDatesSeparator:",",range:!1,todayButton:!1,clearButton:!1,showEvent:"focus",autoClose:!1,monthsFiled:"monthsShort",prevHtml:' ',nextHtml:' ',navTitles:{days:"MM, yyyy ",months:"yyyy",years:"yyyy1 - yyyy2"},timepicker:!1,timeFormat:"hh:ii",onSelect:"",onChangeMonth:"",onChangeYear:"",onChangeDecade:"",onChangeView:"",onRenderCell:""},d={ctrlRight:[17,39],ctrlUp:[17,38],ctrlLeft:[17,37],ctrlDown:[17,40],shiftRight:[16,39],shiftUp:[16,38],shiftLeft:[16,37],shiftDown:[16,40],altUp:[18,38],altRight:[18,39],altLeft:[18,37],altDown:[18,40],ctrlShiftUp:[16,17,38]};Datepicker=function(t,a){this.el=t,this.$el=e(t),this.opts=e.extend(!0,{},l,a,this.$el.data()),s==i&&(s=e("body")),this.opts.startDate||(this.opts.startDate=new Date),"INPUT"==this.el.nodeName&&(this.elIsInput=!0),this.opts.altField&&(this.$altField="string"==typeof this.opts.altField?e(this.opts.altField):this.opts.altField),this.inited=!1,this.visible=!1,this.silent=!1,this.currentDate=this.opts.startDate,this.currentView=this.opts.view,this._createShortCuts(),this.selectedDates=[],this.views={},this.keys=[],this.minRange="",this.maxRange="",this.init()},n=Datepicker,n.prototype={viewIndexes:["days","months","years"],init:function(){o||this.opts.inline||!this.elIsInput||this._buildDatepickersContainer(),this._buildBaseHtml(),this._defineLocale(this.opts.language),this._syncWithMinMaxDates(),this.elIsInput&&(this.opts.inline||(this._setPositionClasses(this.opts.position),this._bindEvents()),this.opts.keyboardNav&&this._bindKeyboardEvents(),this.$datepicker.on("mousedown",this._onMouseDownDatepicker.bind(this)),this.$datepicker.on("mouseup",this._onMouseUpDatepicker.bind(this))),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.views[this.currentView]=new Datepicker.Body(this,this.currentView,this.opts),this.views[this.currentView].show(),this.nav=new Datepicker.Navigation(this,this.opts),this.view=this.currentView,this.opts.timepicker&&(this.timepicker=new Datepicker.Timepicker(this,this.opts),this._bindTimepickerEvents()),this.$datepicker.on("mouseenter",".datepicker--cell",this._onMouseEnterCell.bind(this)),this.$datepicker.on("mouseleave",".datepicker--cell",this._onMouseLeaveCell.bind(this)),this.inited=!0},_createShortCuts:function(){this.minDate=this.opts.minDate?this.opts.minDate:new Date(-86399999136e5),this.maxDate=this.opts.maxDate?this.opts.maxDate:new Date(86399999136e5)},_bindEvents:function(){this.$el.on(this.opts.showEvent+".adp",this._onShowEvent.bind(this)),this.$el.on("mouseup.adp",this._onMouseUpEl.bind(this)),this.$el.on("blur.adp",this._onBlur.bind(this)),this.$el.on("input.adp",this._onInput.bind(this)),e(t).on("resize.adp",this._onResize.bind(this)),e("body").on("mouseup.adp",this._onMouseUpBody.bind(this))},_bindKeyboardEvents:function(){this.$el.on("keydown.adp",this._onKeyDown.bind(this)),this.$el.on("keyup.adp",this._onKeyUp.bind(this)),this.$el.on("hotKey.adp",this._onHotKey.bind(this))},_bindTimepickerEvents:function(){this.$el.on("timeChange.adp",this._onTimeChange.bind(this))},isWeekend:function(t){return-1!==this.opts.weekends.indexOf(t)},_defineLocale:function(t){"string"==typeof t?(this.loc=Datepicker.language[t],this.loc||(console.warn("Can't find language \""+t+'" in Datepicker.language, will use "ru" instead'),this.loc=e.extend(!0,{},Datepicker.language.ru)),this.loc=e.extend(!0,{},Datepicker.language.ru,Datepicker.language[t])):this.loc=e.extend(!0,{},Datepicker.language.ru,t),this.opts.dateFormat&&(this.loc.dateFormat=this.opts.dateFormat),""!==this.opts.firstDay&&(this.loc.firstDay=this.opts.firstDay)},_buildDatepickersContainer:function(){o=!0,s.append('
'),a=e("#datepickers-container")},_buildBaseHtml:function(){var t,i=e('');t="INPUT"==this.el.nodeName?this.opts.inline?i.insertAfter(this.$el):a:i.appendTo(this.$el),this.$datepicker=e(c).appendTo(t),this.$content=e(".datepicker--content",this.$datepicker),this.$nav=e(".datepicker--nav",this.$datepicker)},_triggerOnChange:function(){if(!this.selectedDates.length)return this.opts.onSelect("","",this);var t,e=this.selectedDates,i=n.getParsedDate(e[0]),s=this,a=new Date(i.year,i.month,i.date);t=e.map(function(t){return s.formatDate(s.loc.dateFormat,t)}).join(this.opts.multipleDatesSeparator),(this.opts.multipleDates||this.opts.range)&&(a=e.map(function(t){var e=n.getParsedDate(t);return new Date(e.year,e.month,e.date)})),this.opts.onSelect(t,a,this)},next:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month+1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year+1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year+10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},prev:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month-1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year-1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year-10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},formatDate:function(t,e){e=e||this.date;var i=t,s=this.loc,a=n.getDecade(e),h=n.getParsedDate(e);switch(!0){case/@/.test(i):i=i.replace(/@/,e.getTime());case/dd/.test(i):i=i.replace(/\bdd\b/,h.fullDate);case/d/.test(i):i=i.replace(/\bd\b/,h.date);case/DD/.test(i):i=i.replace(/\bDD\b/,s.days[h.day]);case/D/.test(i):i=i.replace(/\bD\b/,s.daysShort[h.day]);case/mm/.test(i):i=i.replace(/\bmm\b/,h.fullMonth);case/m/.test(i):i=i.replace(/\bm\b/,h.month+1);case/MM/.test(i):i=i.replace(/\bMM\b/,this.loc.months[h.month]);case/M/.test(i):i=i.replace(/\bM\b/,s.monthsShort[h.month]);case/ii/.test(i):i=i.replace(/\bii\b/,h.fullMinutes);case/i/.test(i):i=i.replace(/\bi(?!>)\b/,h.minutes);case/hh/.test(i):i=i.replace(/\bhh\b/,h.fullHours);case/h/.test(i):i=i.replace(/\bh\b/,h.hours);case/yyyy/.test(i):i=i.replace(/\byyyy\b/,h.year);case/yyyy1/.test(i):i=i.replace(/\byyyy1\b/,a[0]);case/yyyy2/.test(i):i=i.replace(/\byyyy2\b/,a[1]);case/yy/.test(i):i=i.replace(/\byy\b/,h.year.toString().slice(-2))}return i},selectDate:function(t){var e=this,i=e.opts,s=e.parsedDate,a=e.selectedDates,n=a.length,h="";if(t instanceof Date){if(this.timepicker&&(t.setHours(this.timepicker.hours),t.setMinutes(this.timepicker.minutes)),"days"==e.view&&t.getMonth()!=s.month&&i.moveToOtherMonthsOnSelect&&(h=new Date(t.getFullYear(),t.getMonth(),1)),"years"==e.view&&t.getFullYear()!=s.year&&i.moveToOtherYearsOnSelect&&(h=new Date(t.getFullYear(),0,1)),h&&(e.silent=!0,e.date=h,e.silent=!1,e.nav._render()),i.multipleDates&&!i.range){if(n===i.multipleDates)return;e._isSelected(t)||e.selectedDates.push(t)}else i.range?2==n?(e.selectedDates=[t],e.minRange=t,e.maxRange=""):1==n?(e.selectedDates.push(t),e.maxRange?e.minRange=t:e.maxRange=t,e.selectedDates=[e.minRange,e.maxRange]):(e.selectedDates=[t],e.minRange=t):e.selectedDates=[t];e._setInputValue(),i.onSelect&&e._triggerOnChange(),i.autoClose&&(i.multipleDates||i.range?i.range&&2==e.selectedDates.length&&e.hide():e.hide()),e.views[this.currentView]._render()}},removeDate:function(t){var e=this.selectedDates,i=this;if(t instanceof Date)return e.some(function(s,a){return n.isSame(s,t)?(e.splice(a,1),i.selectedDates.length||(i.minRange="",i.maxRange=""),i.views[i.currentView]._render(),i._setInputValue(),i.opts.onSelect&&i._triggerOnChange(),!0):void 0})},today:function(){this.silent=!0,this.view=this.opts.minView,this.silent=!1,this.date=new Date},clear:function(){this.selectedDates=[],this.minRange="",this.maxRange="",this.views[this.currentView]._render(),this._setInputValue(),this.opts.onSelect&&this._triggerOnChange()},update:function(t,i){var s=arguments.length;return 2==s?this.opts[t]=i:1==s&&"object"==typeof t&&(this.opts=e.extend(!0,this.opts,t)),this._createShortCuts(),this._syncWithMinMaxDates(),this._defineLocale(this.opts.language),this.nav._addButtonsIfNeed(),this.nav._render(),this.views[this.currentView]._render(),this.elIsInput&&!this.opts.inline&&(this._setPositionClasses(this.opts.position),this.visible&&this.setPosition(this.opts.position)),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this},_syncWithMinMaxDates:function(){var t=this.date.getTime();this.silent=!0,this.minTime>t&&(this.date=this.minDate),this.maxTime
=this.minTime&&i<=this.maxTime,month:r>=this.minTime&&o<=this.maxTime,year:s.year>=a.year&&s.year<=h.year};return e?c[e]:c.day},_getDimensions:function(t){var e=t.offset();return{width:t.outerWidth(),height:t.outerHeight(),left:e.left,top:e.top}},_getDateFromCell:function(t){var e=this.parsedDate,s=t.data("year")||e.year,a=t.data("month")==i?e.month:t.data("month"),n=t.data("date")||1;return new Date(s,a,n)},_setPositionClasses:function(t){t=t.split(" ");var e=t[0],i=t[1],s="datepicker -"+e+"-"+i+"- -from-"+e+"-";this.visible&&(s+=" active"),this.$datepicker.removeAttr("class").addClass(s)},setPosition:function(t){t=t||this.opts.position;var e,i,s=this._getDimensions(this.$el),a=this._getDimensions(this.$datepicker),n=t.split(" "),h=this.opts.offset,r=n[0],o=n[1];switch(r){case"top":e=s.top-a.height-h;break;case"right":i=s.left+s.width+h;break;case"bottom":e=s.top+s.height+h;break;case"left":i=s.left-a.width-h}switch(o){case"top":e=s.top;break;case"right":i=s.left+s.width-a.width;break;case"bottom":e=s.top+s.height-a.height;break;case"left":i=s.left;break;case"center":/left|right/.test(r)?e=s.top+s.height/2-a.height/2:i=s.left+s.width/2-a.width/2}this.$datepicker.css({left:i,top:e})},show:function(){this.setPosition(this.opts.position),this.$datepicker.addClass("active"),this.visible=!0},hide:function(){this.$datepicker.removeClass("active").css({left:"-100000px"}),this.focused="",this.keys=[],this.inFocus=!1,this.visible=!1,this.$el.blur()},down:function(t){this._changeView(t,"down")},up:function(t){this._changeView(t,"up")},_changeView:function(t,e){t=t||this.focused||this.date;var i="up"==e?this.viewIndex+1:this.viewIndex-1;i>2&&(i=2),0>i&&(i=0),this.silent=!0,this.date=new Date(t.getFullYear(),t.getMonth(),1),this.silent=!1,this.view=this.viewIndexes[i]},_handleHotKey:function(t){var e,i,s,a=n.getParsedDate(this._getFocusedDate()),h=this.opts,r=!1,o=!1,c=!1,l=a.year,d=a.month,u=a.date;switch(t){case"ctrlRight":case"ctrlUp":d+=1,r=!0;break;case"ctrlLeft":case"ctrlDown":d-=1,r=!0;break;case"shiftRight":case"shiftUp":o=!0,l+=1;break;case"shiftLeft":case"shiftDown":o=!0,l-=1;break;case"altRight":case"altUp":c=!0,l+=10;break;case"altLeft":case"altDown":c=!0,l-=10;break;case"ctrlShiftUp":this.up()}s=n.getDaysCount(new Date(l,d)),i=new Date(l,d,u),u>s&&(u=s),i.getTime()this.maxTime&&(i=this.maxDate),this.focused=i,e=n.getParsedDate(i),r&&h.onChangeMonth&&h.onChangeMonth(e.month,e.year),o&&h.onChangeYear&&h.onChangeYear(e.year),c&&h.onChangeDecade&&h.onChangeDecade(this.curDecade)},_registerKey:function(t){var e=this.keys.some(function(e){return e==t});e||this.keys.push(t)},_unRegisterKey:function(t){var e=this.keys.indexOf(t);this.keys.splice(e,1)},_isHotKeyPressed:function(){var t,e=!1,i=this,s=this.keys.sort();for(var a in d)t=d[a],s.length==t.length&&t.every(function(t,e){return t==s[e]})&&(i._trigger("hotKey",a),e=!0);return e},_trigger:function(t,e){this.$el.trigger(t,e)},_focusNextCell:function(t,e){e=e||this.cellType;var i=n.getParsedDate(this._getFocusedDate()),s=i.year,a=i.month,h=i.date;if(!this._isHotKeyPressed()){switch(t){case 37:"day"==e?h-=1:"","month"==e?a-=1:"","year"==e?s-=1:"";break;case 38:"day"==e?h-=7:"","month"==e?a-=3:"","year"==e?s-=4:"";break;case 39:"day"==e?h+=1:"","month"==e?a+=1:"","year"==e?s+=1:"";break;case 40:"day"==e?h+=7:"","month"==e?a+=3:"","year"==e?s+=4:""}var r=new Date(s,a,h);r.getTime()this.maxTime&&(r=this.maxDate),this.focused=r}},_getFocusedDate:function(){var t=this.focused||this.selectedDates[this.selectedDates.length-1],e=this.parsedDate;if(!t)switch(this.view){case"days":t=new Date(e.year,e.month,(new Date).getDate());break;case"months":t=new Date(e.year,e.month,1);break;case"years":t=new Date(e.year,0,1)}return t},_getCell:function(t,e){e=e||this.cellType;var i,s=n.getParsedDate(t),a='.datepicker--cell[data-year="'+s.year+'"]';switch(e){case"month":a='[data-month="'+s.month+'"]';break;case"day":a+='[data-month="'+s.month+'"][data-date="'+s.date+'"]'}return i=this.views[this.currentView].$el.find(a),i.length?i:""},destroy:function(){var t=this;t.$el.off(".adp").data("datepicker",""),t.selectedDates=[],t.focused="",t.views={},t.keys=[],t.minRange="",t.maxRange="",t.opts.inline||!t.elIsInput?t.$datepicker.closest(".datepicker-inline").remove():t.$datepicker.remove()},_onShowEvent:function(){this.visible||this.show()},_onBlur:function(){!this.inFocus&&this.visible&&this.hide()},_onMouseDownDatepicker:function(t){this.inFocus=!0},_onMouseUpDatepicker:function(t){this.inFocus=!1,t.originalEvent.inFocus=!0,t.originalEvent.timepickerFocus||this.$el.focus()},_onInput:function(){var t=this.$el.val();t||this.clear()},_onResize:function(){this.visible&&this.setPosition()},_onMouseUpBody:function(t){t.originalEvent.inFocus||this.visible&&!this.inFocus&&this.hide()},_onMouseUpEl:function(t){t.originalEvent.inFocus=!0},_onKeyDown:function(t){var e=t.which;if(this._registerKey(e),e>=37&&40>=e&&(t.preventDefault(),this._focusNextCell(e)),13==e&&this.focused){if(this._getCell(this.focused).hasClass("-disabled-"))return;if(this.view!=this.opts.minView)this.down();else{var i=this._isSelected(this.focused,this.cellType);i?i&&this.opts.toggleSelected&&this.removeDate(this.focused):this.selectDate(this.focused)}}27==e&&this.hide()},_onKeyUp:function(t){var e=t.which;this._unRegisterKey(e)},_onHotKey:function(t,e){this._handleHotKey(e)},_onMouseEnterCell:function(t){var i=e(t.target).closest(".datepicker--cell"),s=this._getDateFromCell(i);this.silent=!0,this.focused&&(this.focused=""),i.addClass("-focus-"),this.focused=s,this.silent=!1,this.opts.range&&1==this.selectedDates.length&&(this.minRange=this.selectedDates[0],this.maxRange="",n.less(this.minRange,this.focused)&&(this.maxRange=this.minRange,this.minRange=""),this.views[this.currentView]._update())},_onMouseLeaveCell:function(t){var i=e(t.target).closest(".datepicker--cell");i.removeClass("-focus-"),this.silent=!0,this.focused="",this.silent=!1},_onTimeChange:function(t,e,i){var s=new Date,a=this.selectedDates,n=!1;a.length&&(n=!0,s=this.selectedDates[this.selectedDates.length-1]),s.setHours(e),s.setMinutes(i),n?(this.selectedDates[a.length-1]=s,this._setInputValue(),this._triggerOnChange()):this.selectDate(s)},set focused(t){if(!t&&this.focused){var e=this._getCell(this.focused);e.length&&e.removeClass("-focus-")}this._focused=t,this.opts.range&&1==this.selectedDates.length&&(this.minRange=this.selectedDates[0],this.maxRange="",n.less(this.minRange,this._focused)&&(this.maxRange=this.minRange,this.minRange="")),this.silent||(this.date=t)},get focused(){return this._focused},get parsedDate(){return n.getParsedDate(this.date)},set date(t){return t instanceof Date?(this.currentDate=t,this.inited&&!this.silent&&(this.views[this.view]._render(),this.nav._render(),this.visible&&this.elIsInput&&this.setPosition()),t):void 0},get date(){return this.currentDate},set view(t){return this.viewIndex=this.viewIndexes.indexOf(t),this.viewIndex<0?void 0:(this.prevView=this.currentView,this.currentView=t,this.inited&&(this.views[t]?this.views[t]._render():this.views[t]=new Datepicker.Body(this,t,this.opts),this.views[this.prevView].hide(),this.views[t].show(),this.nav._render(),this.opts.onChangeView&&this.opts.onChangeView(t),this.elIsInput&&this.visible&&this.setPosition()),t)},get view(){return this.currentView},get cellType(){return this.view.substring(0,this.view.length-1)},get minTime(){var t=n.getParsedDate(this.minDate);return new Date(t.year,t.month,t.date).getTime()},get maxTime(){var t=n.getParsedDate(this.maxDate);return new Date(t.year,t.month,t.date).getTime()},get curDecade(){return n.getDecade(this.date)}},n.getDaysCount=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},n.getParsedDate=function(t){return{year:t.getFullYear(),month:t.getMonth(),fullMonth:t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1,date:t.getDate(),fullDate:t.getDate()<10?"0"+t.getDate():t.getDate(),day:t.getDay(),hours:t.getHours(),fullHours:t.getHours()<10?"0"+t.getHours():t.getHours(),minutes:t.getMinutes(),fullMinutes:t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes()}},n.getDecade=function(t){var e=10*Math.floor(t.getFullYear()/10);return[e,e+9]},n.template=function(t,e){return t.replace(/#\{([\w]+)\}/g,function(t,i){return e[i]||0===e[i]?e[i]:void 0})},n.isSame=function(t,e,i){if(!t||!e)return!1;var s=n.getParsedDate(t),a=n.getParsedDate(e),h=i?i:"day",r={day:s.date==a.date&&s.month==a.month&&s.year==a.year,month:s.month==a.month&&s.year==a.year,year:s.year==a.year};return r[h]},n.less=function(t,e,i){return t&&e?e.getTime()t.getTime():!1},Datepicker.language={ru:{days:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],daysShort:["Вос","Пон","Вто","Сре","Чет","Пят","Суб"],daysMin:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],today:"Сегодня",clear:"Очистить",dateFormat:"dd.mm.yyyy",firstDay:1}},e.fn[h]=function(t){return this.each(function(){if(e.data(this,h)){var i=e.data(this,h);i.opts=e.extend(!0,i.opts,t),i.update()}else e.data(this,h,new Datepicker(this,t))})},e(function(){e(r).datepicker()})}(window,jQuery),function(){var t={days:'',months:'',years:''},e=Datepicker;e.Body=function(t,e,i){this.d=t,this.type=e,this.opts=i,this.init()},e.Body.prototype={init:function(){this._buildBaseHtml(),this._render(),this._bindEvents()},_bindEvents:function(){this.$el.on("click",".datepicker--cell",$.proxy(this._onClickCell,this))},_buildBaseHtml:function(){this.$el=$(t[this.type]).appendTo(this.d.$content),this.$names=$(".datepicker--days-names",this.$el),this.$cells=$(".datepicker--cells",this.$el)},_getDayNamesHtml:function(t,e,i,s){return e=void 0!=e?e:t,i=i?i:"",s=void 0!=s?s:0,s>7?i:7==e?this._getDayNamesHtml(t,0,i,++s):(i+=''+this.d.loc.daysMin[e]+"
",this._getDayNamesHtml(t,++e,i,++s))},_getCellContents:function(t,i){var s="datepicker--cell datepicker--cell-"+i,a=new Date,n=this.d,h=n.opts,r=e.getParsedDate(t),o={},c=r.date;switch(h.onRenderCell&&(o=h.onRenderCell(t,i)||{},c=o.html?o.html:c,s+=o.classes?" "+o.classes:""),i){case"day":n.isWeekend(r.day)&&(s+=" -weekend-"),r.month!=this.d.parsedDate.month&&(s+=" -other-month-",h.selectOtherMonths||(s+=" -disabled-"),h.showOtherMonths||(c=""));break;case"month":c=n.loc[n.opts.monthsFiled][r.month];break;case"year":var l=n.curDecade;c=r.year,(r.yearl[1])&&(s+=" -other-decade-",h.selectOtherYears||(s+=" -disabled-"),h.showOtherYears||(c=""))}return h.onRenderCell&&(o=h.onRenderCell(t,i)||{},c=o.html?o.html:c,s+=o.classes?" "+o.classes:""),h.range&&(e.isSame(n.minRange,t,i)&&(s+=" -range-from-"),e.isSame(n.maxRange,t,i)&&(s+=" -range-to-"),1==n.selectedDates.length&&n.focused?((e.bigger(n.minRange,t)&&e.less(n.focused,t)||e.less(n.maxRange,t)&&e.bigger(n.focused,t))&&(s+=" -in-range-"),e.less(n.maxRange,t)&&e.isSame(n.focused,t)&&(s+=" -range-from-"),e.bigger(n.minRange,t)&&e.isSame(n.focused,t)&&(s+=" -range-to-")):2==n.selectedDates.length&&e.bigger(n.minRange,t)&&e.less(n.maxRange,t)&&(s+=" -in-range-")),e.isSame(a,t,i)&&(s+=" -current-"),n.focused&&e.isSame(t,n.focused,i)&&(s+=" -focus-"),n._isSelected(t,i)&&(s+=" -selected-"),(!n._isInRange(t,i)||o.disabled)&&(s+=" -disabled-"),{html:c,classes:s}},_getDaysHtml:function(t){var i=e.getDaysCount(t),s=new Date(t.getFullYear(),t.getMonth(),1).getDay(),a=new Date(t.getFullYear(),t.getMonth(),i).getDay(),n=s-this.d.loc.firstDay,h=6-a+this.d.loc.firstDay;n=0>n?n+7:n,h=h>6?h-7:h;for(var r,o,c=-n+1,l="",d=c,u=i+h;u>=d;d++)o=t.getFullYear(),r=t.getMonth(),l+=this._getDayHtml(new Date(o,r,d));return l},_getDayHtml:function(t){var e=this._getCellContents(t,"day");return''+e.html+"
"},_getMonthsHtml:function(t){for(var i="",s=e.getParsedDate(t),a=0;12>a;)i+=this._getMonthHtml(new Date(s.year,a)),a++;return i},_getMonthHtml:function(t){var e=this._getCellContents(t,"month");return''+e.html+"
"},_getYearsHtml:function(t){var i=(e.getParsedDate(t),e.getDecade(t)),s=i[0]-1,a="",n=s;for(n;n<=i[1]+1;n++)a+=this._getYearHtml(new Date(n,0));return a},_getYearHtml:function(t){var e=this._getCellContents(t,"year");return''+e.html+"
"},_renderTypes:{days:function(){var t=this._getDayNamesHtml(this.d.loc.firstDay),e=this._getDaysHtml(this.d.currentDate);this.$cells.html(e),this.$names.html(t)},months:function(){var t=this._getMonthsHtml(this.d.currentDate);this.$cells.html(t)},years:function(){var t=this._getYearsHtml(this.d.currentDate);this.$cells.html(t)}},_render:function(){this._renderTypes[this.type].bind(this)()},_update:function(){var t,e,i,s=$(".datepicker--cell",this.$cells),a=this;s.each(function(s,n){e=$(this),i=a.d._getDateFromCell($(this)),t=a._getCellContents(i,a.d.cellType),e.attr("class",t.classes)})},show:function(){this.$el.addClass("active"),this.acitve=!0},hide:function(){this.$el.removeClass("active"),this.active=!1},_handleClick:function(t){var e=t.data("date")||1,i=t.data("month")||0,s=t.data("year")||this.d.parsedDate.year;if(this.d.view!=this.opts.minView)return void this.d.down(new Date(s,i,e));var a=new Date(s,i,e),n=this.d._isSelected(a,this.d.cellType);n?n&&this.opts.toggleSelected&&this.d.removeDate(a):this.d.selectDate(a)},_onClickCell:function(t){var e=$(t.target).closest(".datepicker--cell");e.hasClass("-disabled-")||this._handleClick.bind(this)(e)}}}(),function(){var t='#{prevHtml}
#{title}
#{nextHtml}
',e='
',i='#{label} ';Datepicker.Navigation=function(t,e){this.d=t,this.opts=e,this.$buttonsContainer="",this.init()},Datepicker.Navigation.prototype={init:function(){this._buildBaseHtml(),this._bindEvents()},_bindEvents:function(){this.d.$nav.on("click",".datepicker--nav-action",$.proxy(this._onClickNavButton,this)),this.d.$nav.on("click",".datepicker--nav-title",$.proxy(this._onClickNavTitle,this)),this.d.$datepicker.on("click",".datepicker--button",$.proxy(this._onClickNavButton,this))},_buildBaseHtml:function(){this._render(),this._addButtonsIfNeed()},_addButtonsIfNeed:function(){this.opts.todayButton&&this._addButton("today"),this.opts.clearButton&&this._addButton("clear")},_render:function(){var e=this._getTitle(this.d.currentDate),i=Datepicker.template(t,$.extend({title:e},this.opts));this.d.$nav.html(i),"years"==this.d.view&&$(".datepicker--nav-title",this.d.$nav).addClass("-disabled-"),this.setNavStatus()},_getTitle:function(t){return this.d.formatDate(this.opts.navTitles[this.d.view],t)},_addButton:function(t){this.$buttonsContainer.length||this._addButtonsContainer();var e={action:t,label:this.d.loc[t]},s=Datepicker.template(i,e);$("[data-action="+t+"]",this.$buttonsContainer).length||this.$buttonsContainer.append(s)},_addButtonsContainer:function(){this.d.$datepicker.append(e),this.$buttonsContainer=$(".datepicker--buttons",this.d.$datepicker)},setNavStatus:function(){if((this.opts.minDate||this.opts.maxDate)&&this.opts.disableNavWhenOutOfRange){var t=this.d.parsedDate,e=t.month,i=t.year,s=t.date;switch(this.d.view){case"days":this.d._isInRange(new Date(i,e-1,s),"month")||this._disableNav("prev"),this.d._isInRange(new Date(i,e+1,s),"month")||this._disableNav("next");break;case"months":this.d._isInRange(new Date(i-1,e,s),"year")||this._disableNav("prev"),this.d._isInRange(new Date(i+1,e,s),"year")||this._disableNav("next");break;case"years":this.d._isInRange(new Date(i-10,e,s),"year")||this._disableNav("prev"),this.d._isInRange(new Date(i+10,e,s),"year")||this._disableNav("next")}}},_disableNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).addClass("-disabled-")},_activateNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).removeClass("-disabled-")},_onClickNavButton:function(t){var e=$(t.target).closest("[data-action]"),i=e.data("action");this.d[i]()},_onClickNavTitle:function(t){return $(t.target).hasClass("-disabled-")?void 0:"days"==this.d.view?this.d.view="months":void(this.d.view="years")}}}(),function(t,e,i){var s='',a=10;i.Timepicker=function(t,e){this.d=t,this.opts=e;var i=this.d.parsedDate;this.minutes=i.minutes,this.hours=i.hours,this._minutes=i.minutes,this._hours=i.hours,this.init()},i.Timepicker.prototype={init:function(){var t="input";this._buildHTML(),navigator.userAgent.match(/trident/gi)&&(t="change"),this.$ranges.on(t,this._onChangeRange.bind(this)),this.$currentInputs.on("mouseup",this._onMouseUpInput.bind(this)),this.$currentInputs.on("keydown",this._onKeyPressInput.bind(this)),this.$currentInputs.on("input",this._onInputInput.bind(this)),this.$currentInputs.on("blur",this._onBlurInput.bind(this)),this.$currentInputs.on("paste",this._onPasteInput.bind(this))},_buildHTML:function(){var t=this.d.parsedDate,a={hourMin:"00",hourMax:"23",hourStep:"1",hourValue:t.fullHours,hourLabel:"Часы",minMin:"00",minMax:"59",minStep:"1",minValue:t.fullMinutes,minLabel:"Минуты"},n=i.template(s,a);this.$timepicker=e(n).appendTo(this.d.$datepicker),this.$ranges=e('[type="range"]',this.$timepicker),this.$currentTime=e(".datepicker--time-current",this.$timepicker),this.$currentInputs=e('input[type="text"]',this.$timepicker),this.$hoursText=e('[name="hours-current"]',this.$timepicker),this.$minutesText=e('[name="minutes-current"]',this.$timepicker)},_render:function(){},_updateTime:function(){var t=this.hours<10?"0"+this.hours:this.hours,e=this.minutes<10?"0"+this.minutes:this.minutes;this.$hoursText.val(t),this.$minutesText.val(e)},_onChangeRange:function(t){var i=e(t.target),s=i.val(),a=i.attr("name");this[a]=s,this._updateTime(),this.d._trigger("timeChange",[this.hours,this.minutes])},_onMouseUpInput:function(t){t.originalEvent.inFocus=!0,t.originalEvent.timepickerFocus=!0},_onKeyPressInput:function(t){var i,s=e(t.target),n=(s.data("field"),s.data("max")),h=this,r=t.which,o=s.data("action"),c=s.val(),l=s.val();return setTimeout(function(){return l=s.val(),i=parseInt(l),i>n?void s.val(c):(2==l.length&&"next"==o&&r>=48&&57>=r&&h.$minutesText.focus().select(),void(l.length||"prev"==o&&8==r&&(h.$hoursText.focus(),h.$hoursText[0].selectionStart=2,h.$hoursText[0].selectionEnd=2)))},a),r>=48&&57>=r||r>=37&&40>=r||r>=96&&105>=r||17==r||13==r||46==r||8==r||9==r},_onInputInput:function(t){var i=e(t.target),s=this,n=i.data("field"),h=i.data("max"),r=parseInt(i.val());setTimeout(function(){r=parseInt(i.val()),r>h?(r=h,i.val(r)):r||(r=s["_"+n]),s[n]=r,e('[name="'+n+'"]').val(r),s.d._trigger("timeChange",[s.hours,s.minutes])},a)},_onBlurInput:function(t){var i=e(t.target),s=i.val();1==s.length&&(s="0"+s,i.val(s))},_onPasteInput:function(t){var i=e(t.target),s=i.val();setTimeout(function(){s=i.val().replace(/\D/gi,""),i.val(s)},a)}}}(window,jQuery,Datepicker);
\ No newline at end of file
diff --git a/src/js/datepicker.js b/src/js/datepicker.js
index 9865d4c..d08907d 100644
--- a/src/js/datepicker.js
+++ b/src/js/datepicker.js
@@ -182,9 +182,11 @@ var Datepicker;
_bindEvents : function () {
this.$el.on(this.opts.showEvent + '.adp', this._onShowEvent.bind(this));
+ this.$el.on('mouseup.adp', this._onMouseUpEl.bind(this));
this.$el.on('blur.adp', this._onBlur.bind(this));
this.$el.on('input.adp', this._onInput.bind(this));
$(window).on('resize.adp', this._onResize.bind(this));
+ $('body').on('mouseup.adp', this._onMouseUpBody.bind(this));
},
_bindKeyboardEvents: function () {
@@ -950,11 +952,11 @@ var Datepicker;
_onMouseUpDatepicker: function (e) {
this.inFocus = false;
- this.$el.focus()
+ e.originalEvent.inFocus = true;
+ if (!e.originalEvent.timepickerFocus) this.$el.focus();
},
_onInput: function () {
- console.log(234);
var val = this.$el.val();
if (!val) {
@@ -968,6 +970,18 @@ var Datepicker;
}
},
+ _onMouseUpBody: function (e) {
+ if (e.originalEvent.inFocus) return;
+
+ if (this.visible && !this.inFocus) {
+ this.hide();
+ }
+ },
+
+ _onMouseUpEl: function (e) {
+ e.originalEvent.inFocus = true;
+ },
+
_onKeyDown: function (e) {
var code = e.which;
this._registerKey(code);
diff --git a/src/js/timepicker.js b/src/js/timepicker.js
index 57d164c..35d7b2f 100644
--- a/src/js/timepicker.js
+++ b/src/js/timepicker.js
@@ -10,8 +10,13 @@
' ' +
' ' +
' ' +
- '#{hourValue}:#{minValue}
' +
- '';
+ '' +
+ ' ' +
+ ' : ' +
+ '
' +
+ '',
+ inputTimeout = 10;
+
datepicker.Timepicker = function (inst, opts) {
this.d = inst;
this.opts = opts;
@@ -19,6 +24,8 @@
var date = this.d.parsedDate;
this.minutes = date.minutes;
this.hours = date.hours;
+ this._minutes = date.minutes;
+ this._hours = date.hours;
this.init();
};
@@ -33,6 +40,11 @@
}
this.$ranges.on(input, this._onChangeRange.bind(this));
+ this.$currentInputs.on('mouseup', this._onMouseUpInput.bind(this));
+ this.$currentInputs.on('keydown', this._onKeyPressInput.bind(this));
+ this.$currentInputs.on('input', this._onInputInput.bind(this));
+ this.$currentInputs.on('blur', this._onBlurInput.bind(this));
+ this.$currentInputs.on('paste', this._onPasteInput.bind(this));
},
_buildHTML: function () {
@@ -41,12 +53,12 @@
hourMin: '00',
hourMax: '23',
hourStep: '1',
- hourValue: date.hours,
+ hourValue: date.fullHours,
hourLabel: 'Часы',
minMin: '00',
minMax: '59',
minStep: '1',
- minValue: date.minutes,
+ minValue: date.fullMinutes,
minLabel: 'Минуты'
},
_template = datepicker.template(template, data);
@@ -54,6 +66,9 @@
this.$timepicker = $(_template).appendTo(this.d.$datepicker);
this.$ranges = $('[type="range"]', this.$timepicker);
this.$currentTime = $('.datepicker--time-current', this.$timepicker);
+ this.$currentInputs = $('input[type="text"]', this.$timepicker);
+ this.$hoursText = $('[name="hours-current"]', this.$timepicker);
+ this.$minutesText = $('[name="minutes-current"]', this.$timepicker);
},
_render: function () {
@@ -64,7 +79,9 @@
var h = this.hours < 10 ? '0'+this.hours : this.hours,
m = this.minutes < 10 ? '0' + this.minutes : this.minutes,
html = h + ':' + m;
- this.$currentTime.html(html);
+
+ this.$hoursText.val(h);
+ this.$minutesText.val(m)
},
_onChangeRange: function (e) {
@@ -75,6 +92,103 @@
this[name] = value;
this._updateTime();
this.d._trigger('timeChange', [this.hours, this.minutes])
+ },
+
+ _onMouseUpInput: function (e) {
+ e.originalEvent.inFocus = true;
+ e.originalEvent.timepickerFocus = true;
+ },
+
+ _onKeyPressInput: function (e) {
+ var $el = $(e.target),
+ field = $el.data('field'),
+ max = $el.data('max'),
+ _this = this,
+ charCode = e.which,
+ action = $el.data('action'),
+ parsedVal,
+ initialValue = $el.val(),
+ val = $el.val();
+
+ setTimeout(function () {
+ val = $el.val();
+ parsedVal = parseInt(val);
+
+ if (parsedVal > max) {
+ $el.val(initialValue);
+ return;
+ }
+
+ if (val.length == 2) {
+ if (action == 'next' && charCode >= 48 && charCode <= 57) {
+ _this.$minutesText.focus().select();
+ }
+ }
+
+ if (!val.length) {
+ if (action == 'prev' && charCode == 8) {
+ _this.$hoursText.focus();
+
+ _this.$hoursText[0].selectionStart = 2;
+ _this.$hoursText[0].selectionEnd = 2;
+ }
+ }
+
+
+ }, inputTimeout);
+
+ return charCode >= 48 && charCode <= 57
+ || (charCode >= 37 && charCode <= 40)
+ || (charCode >= 96 && charCode <= 105)
+ || charCode == 17
+ || charCode == 13
+ || charCode == 46
+ || charCode == 8
+ || charCode == 9;
+ },
+
+ _onInputInput: function (e) {
+ var $el = $(e.target),
+ _this = this,
+ field = $el.data('field'),
+ max = $el.data('max'),
+ val = parseInt($el.val());
+
+ setTimeout(function () {
+ val = parseInt($el.val());
+
+ if (val > max) {
+ val = max;
+ $el.val(val);
+ } else if (!val) {
+ val = _this['_' + field]
+ }
+
+ _this[field] = val;
+ $('[name="' + field + '"]').val(val);
+ _this.d._trigger('timeChange',[_this.hours, _this.minutes])
+ }, inputTimeout)
+ },
+
+ _onBlurInput: function (e) {
+ var $el = $(e.target),
+ val = $el.val();
+
+ if (val.length == 1) {
+ val = '0' + val;
+ $el.val(val);
+ }
+ },
+
+ _onPasteInput: function (e) {
+ var $el = $(e.target),
+ val = $el.val(),
+ _this = this;
+
+ setTimeout(function () {
+ val = $el.val().replace(/\D/gi, '');
+ $el.val(val);
+ }, inputTimeout)
}
};
})(window, jQuery, Datepicker);
diff --git a/src/sass/timepicker.scss b/src/sass/timepicker.scss
index d8616d7..7eead87 100644
--- a/src/sass/timepicker.scss
+++ b/src/sass/timepicker.scss
@@ -41,9 +41,28 @@ $rangeThumbBg: #dedede;
}
.datepicker--time-current {
+ display: flex;
+ align-items: center;
+ justify-content: center;
font-size: 16px;
flex: 1;
text-align: center;
+
+ input[type='text'] {
+ box-sizing: content-box;
+ border: none;
+ padding: 0 3px;
+ margin: 0;
+ outline: none;
+ box-shadow: none;
+ font-size: 16px;
+ width: 18px;
+ height: 23px;
+ }
+
+ > {
+ flex: 1;
+ }
}
.datepicker--time-row {