diff --git a/CHANGELOG.md b/CHANGELOG.md index dc50d15..06d1eae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.0.3 (Dec 20, 2018) + +- Ignore hours, minutes, seconds and milliseconds of parsed date to avoid side effect (#192) +- Fix day view when the selected day is not in the current year (#194). + ## 1.0.2 (Dec 15, 2018) - Convert 2-digit year to 2000+ (#186). diff --git a/README.md b/README.md index 1143703..180c2be 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ > A simple jQuery datepicker plugin. -- [Website](https://fengyuanchen.github.io/datepicker/) +- [Website](https://fengyuanchen.github.io/datepicker) ## Table of contents diff --git a/dist/datepicker.common.js b/dist/datepicker.common.js index e8f278a..08c239e 100644 --- a/dist/datepicker.common.js +++ b/dist/datepicker.common.js @@ -1,11 +1,11 @@ /*! - * Datepicker v1.0.2 + * Datepicker v1.0.3 * https://fengyuanchen.github.io/datepicker * * Copyright 2014-present Chen Fengyuan * Released under the MIT license * - * Date: 2018-12-15T03:52:10.525Z + * Date: 2018-12-20T12:51:42.329Z */ 'use strict'; @@ -484,50 +484,49 @@ var methods = { var format = this.format; var parts = []; - if (isDate(date)) { - return new Date(date.getFullYear(), date.getMonth(), date.getDate()); - } + if (!isDate(date)) { + if (isString(date)) { + parts = date.match(REGEXP_DIGITS) || []; + } - if (isString(date)) { - parts = date.match(REGEXP_DIGITS) || []; - } + date = date ? new Date(date) : new Date(); - var parsedDate = date ? new Date(date) : new Date(); + if (!isDate(date)) { + date = new Date(); + } - if (!isDate(parsedDate)) { - parsedDate = new Date(); - } + if (parts.length === format.parts.length) { + $.each(parts, function (i, part) { + var value = parseInt(part, 10); - if (parts.length === format.parts.length) { - $.each(parts, function (i, part) { - var value = parseInt(part, 10); + switch (format.parts[i]) { + case 'dd': + case 'd': + date.setDate(value); + break; - switch (format.parts[i]) { - case 'dd': - case 'd': - parsedDate.setDate(value); - break; + case 'mm': + case 'm': + date.setMonth(value - 1); + break; - case 'mm': - case 'm': - parsedDate.setMonth(value - 1); - break; + case 'yy': + date.setFullYear(2000 + value); + break; - case 'yy': - parsedDate.setFullYear(2000 + value); - break; + case 'yyyy': + // Converts 2-digit year to 2000+ + date.setFullYear(part.length === 2 ? 2000 + value : value); + break; - case 'yyyy': - // Converts 2-digit year to 2000+ - parsedDate.setFullYear(part.length === 2 ? 2000 + value : value); - break; + default: + } + }); + } + } // Ignore hours, minutes, seconds and milliseconds to avoid side effect (#192) - default: - } - }); - } - return parsedDate; + return new Date(date.getFullYear(), date.getMonth(), date.getDate()); }, /** @@ -706,8 +705,10 @@ var handlers = { } viewDay = parseInt($target.text(), 10); + date.setFullYear(viewYear); date.setMonth(viewMonth); date.setDate(viewDay); + viewDate.setFullYear(viewYear); viewDate.setMonth(viewMonth); viewDate.setDate(viewDay); this.renderDays(); diff --git a/dist/datepicker.css b/dist/datepicker.css index 31653b6..fef28ab 100644 --- a/dist/datepicker.css +++ b/dist/datepicker.css @@ -1,11 +1,11 @@ /*! - * Datepicker v1.0.2 + * Datepicker v1.0.3 * https://fengyuanchen.github.io/datepicker * * Copyright 2014-present Chen Fengyuan * Released under the MIT license * - * Date: 2018-12-15T03:52:06.949Z + * Date: 2018-12-20T12:51:39.076Z */ .datepicker-container { diff --git a/dist/datepicker.esm.js b/dist/datepicker.esm.js index aea82f2..36aa050 100644 --- a/dist/datepicker.esm.js +++ b/dist/datepicker.esm.js @@ -1,11 +1,11 @@ /*! - * Datepicker v1.0.2 + * Datepicker v1.0.3 * https://fengyuanchen.github.io/datepicker * * Copyright 2014-present Chen Fengyuan * Released under the MIT license * - * Date: 2018-12-15T03:52:10.525Z + * Date: 2018-12-20T12:51:42.329Z */ import $ from 'jquery'; @@ -480,50 +480,49 @@ var methods = { var format = this.format; var parts = []; - if (isDate(date)) { - return new Date(date.getFullYear(), date.getMonth(), date.getDate()); - } + if (!isDate(date)) { + if (isString(date)) { + parts = date.match(REGEXP_DIGITS) || []; + } - if (isString(date)) { - parts = date.match(REGEXP_DIGITS) || []; - } + date = date ? new Date(date) : new Date(); - var parsedDate = date ? new Date(date) : new Date(); + if (!isDate(date)) { + date = new Date(); + } - if (!isDate(parsedDate)) { - parsedDate = new Date(); - } + if (parts.length === format.parts.length) { + $.each(parts, function (i, part) { + var value = parseInt(part, 10); - if (parts.length === format.parts.length) { - $.each(parts, function (i, part) { - var value = parseInt(part, 10); + switch (format.parts[i]) { + case 'dd': + case 'd': + date.setDate(value); + break; - switch (format.parts[i]) { - case 'dd': - case 'd': - parsedDate.setDate(value); - break; + case 'mm': + case 'm': + date.setMonth(value - 1); + break; - case 'mm': - case 'm': - parsedDate.setMonth(value - 1); - break; + case 'yy': + date.setFullYear(2000 + value); + break; - case 'yy': - parsedDate.setFullYear(2000 + value); - break; + case 'yyyy': + // Converts 2-digit year to 2000+ + date.setFullYear(part.length === 2 ? 2000 + value : value); + break; - case 'yyyy': - // Converts 2-digit year to 2000+ - parsedDate.setFullYear(part.length === 2 ? 2000 + value : value); - break; + default: + } + }); + } + } // Ignore hours, minutes, seconds and milliseconds to avoid side effect (#192) - default: - } - }); - } - return parsedDate; + return new Date(date.getFullYear(), date.getMonth(), date.getDate()); }, /** @@ -702,8 +701,10 @@ var handlers = { } viewDay = parseInt($target.text(), 10); + date.setFullYear(viewYear); date.setMonth(viewMonth); date.setDate(viewDay); + viewDate.setFullYear(viewYear); viewDate.setMonth(viewMonth); viewDate.setDate(viewDay); this.renderDays(); diff --git a/dist/datepicker.js b/dist/datepicker.js index 0074e1f..d5f04ba 100644 --- a/dist/datepicker.js +++ b/dist/datepicker.js @@ -1,18 +1,18 @@ /*! - * Datepicker v1.0.2 + * Datepicker v1.0.3 * https://fengyuanchen.github.io/datepicker * * Copyright 2014-present Chen Fengyuan * Released under the MIT license * - * Date: 2018-12-15T03:52:10.525Z + * Date: 2018-12-20T12:51:42.329Z */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : typeof define === 'function' && define.amd ? define(['jquery'], factory) : - (factory(global.jQuery)); -}(this, (function ($) { 'use strict'; + (global = global || self, factory(global.jQuery)); +}(this, function ($) { 'use strict'; $ = $ && $.hasOwnProperty('default') ? $['default'] : $; @@ -486,50 +486,49 @@ var format = this.format; var parts = []; - if (isDate(date)) { - return new Date(date.getFullYear(), date.getMonth(), date.getDate()); - } + if (!isDate(date)) { + if (isString(date)) { + parts = date.match(REGEXP_DIGITS) || []; + } - if (isString(date)) { - parts = date.match(REGEXP_DIGITS) || []; - } + date = date ? new Date(date) : new Date(); - var parsedDate = date ? new Date(date) : new Date(); + if (!isDate(date)) { + date = new Date(); + } - if (!isDate(parsedDate)) { - parsedDate = new Date(); - } + if (parts.length === format.parts.length) { + $.each(parts, function (i, part) { + var value = parseInt(part, 10); - if (parts.length === format.parts.length) { - $.each(parts, function (i, part) { - var value = parseInt(part, 10); + switch (format.parts[i]) { + case 'dd': + case 'd': + date.setDate(value); + break; - switch (format.parts[i]) { - case 'dd': - case 'd': - parsedDate.setDate(value); - break; + case 'mm': + case 'm': + date.setMonth(value - 1); + break; - case 'mm': - case 'm': - parsedDate.setMonth(value - 1); - break; + case 'yy': + date.setFullYear(2000 + value); + break; - case 'yy': - parsedDate.setFullYear(2000 + value); - break; + case 'yyyy': + // Converts 2-digit year to 2000+ + date.setFullYear(part.length === 2 ? 2000 + value : value); + break; - case 'yyyy': - // Converts 2-digit year to 2000+ - parsedDate.setFullYear(part.length === 2 ? 2000 + value : value); - break; + default: + } + }); + } + } // Ignore hours, minutes, seconds and milliseconds to avoid side effect (#192) - default: - } - }); - } - return parsedDate; + return new Date(date.getFullYear(), date.getMonth(), date.getDate()); }, /** @@ -708,8 +707,10 @@ } viewDay = parseInt($target.text(), 10); + date.setFullYear(viewYear); date.setMonth(viewMonth); date.setDate(viewDay); + viewDate.setFullYear(viewYear); viewDate.setMonth(viewMonth); viewDate.setDate(viewDay); this.renderDays(); @@ -1493,4 +1494,4 @@ }; } -}))); +})); diff --git a/dist/datepicker.min.css b/dist/datepicker.min.css index 2ff6d93..ffdf23d 100644 --- a/dist/datepicker.min.css +++ b/dist/datepicker.min.css @@ -1,9 +1,9 @@ /*! - * Datepicker v1.0.2 + * Datepicker v1.0.3 * https://fengyuanchen.github.io/datepicker * * Copyright 2014-present Chen Fengyuan * Released under the MIT license * - * Date: 2018-12-15T03:52:06.949Z + * Date: 2018-12-20T12:51:39.076Z */.datepicker-container{background-color:#fff;direction:ltr;font-size:12px;left:0;line-height:30px;position:fixed;-webkit-tap-highlight-color:transparent;top:0;-ms-touch-action:none;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:210px;z-index:-1}.datepicker-container:after,.datepicker-container:before{border:5px solid rgba(0,0,0,0);content:" ";display:block;height:0;position:absolute;width:0}.datepicker-dropdown{border:1px solid #ccc;-webkit-box-shadow:0 3px 6px #ccc;box-shadow:0 3px 6px #ccc;-webkit-box-sizing:content-box;box-sizing:content-box;position:absolute;z-index:1}.datepicker-inline{position:static}.datepicker-top-left,.datepicker-top-right{border-top-color:#39f}.datepicker-top-left:after,.datepicker-top-left:before,.datepicker-top-right:after,.datepicker-top-right:before{border-top:0;left:10px;top:-5px}.datepicker-top-left:before,.datepicker-top-right:before{border-bottom-color:#39f}.datepicker-top-left:after,.datepicker-top-right:after{border-bottom-color:#fff;top:-4px}.datepicker-bottom-left,.datepicker-bottom-right{border-bottom-color:#39f}.datepicker-bottom-left:after,.datepicker-bottom-left:before,.datepicker-bottom-right:after,.datepicker-bottom-right:before{border-bottom:0;bottom:-5px;left:10px}.datepicker-bottom-left:before,.datepicker-bottom-right:before{border-top-color:#39f}.datepicker-bottom-left:after,.datepicker-bottom-right:after{border-top-color:#fff;bottom:-4px}.datepicker-bottom-right:after,.datepicker-bottom-right:before,.datepicker-top-right:after,.datepicker-top-right:before{left:auto;right:10px}.datepicker-panel>ul{margin:0;padding:0;width:102%}.datepicker-panel>ul:after,.datepicker-panel>ul:before{content:" ";display:table}.datepicker-panel>ul:after{clear:both}.datepicker-panel>ul>li{background-color:#fff;cursor:pointer;float:left;height:30px;list-style:none;margin:0;padding:0;text-align:center;width:30px}.datepicker-panel>ul>li:hover{background-color:#e5f2ff}.datepicker-panel>ul>li.muted,.datepicker-panel>ul>li.muted:hover{color:#999}.datepicker-panel>ul>li.highlighted{background-color:#e5f2ff}.datepicker-panel>ul>li.highlighted:hover{background-color:#cce5ff}.datepicker-panel>ul>li.picked,.datepicker-panel>ul>li.picked:hover{color:#39f}.datepicker-panel>ul>li.disabled,.datepicker-panel>ul>li.disabled:hover{background-color:#fff;color:#ccc;cursor:default}.datepicker-panel>ul>li.disabled.highlighted,.datepicker-panel>ul>li.disabled:hover.highlighted{background-color:#e5f2ff}.datepicker-panel>ul>li[data-view="month next"],.datepicker-panel>ul>li[data-view="month prev"],.datepicker-panel>ul>li[data-view="year next"],.datepicker-panel>ul>li[data-view="year prev"],.datepicker-panel>ul>li[data-view="years next"],.datepicker-panel>ul>li[data-view="years prev"],.datepicker-panel>ul>li[data-view=next]{font-size:18px}.datepicker-panel>ul>li[data-view="month current"],.datepicker-panel>ul>li[data-view="year current"],.datepicker-panel>ul>li[data-view="years current"]{width:150px}.datepicker-panel>ul[data-view=months]>li,.datepicker-panel>ul[data-view=years]>li{height:52.5px;line-height:52.5px;width:52.5px}.datepicker-panel>ul[data-view=week]>li,.datepicker-panel>ul[data-view=week]>li:hover{background-color:#fff;cursor:default}.datepicker-hide{display:none} \ No newline at end of file diff --git a/dist/datepicker.min.js b/dist/datepicker.min.js index 24f0f1f..9586882 100644 --- a/dist/datepicker.min.js +++ b/dist/datepicker.min.js @@ -1,10 +1,10 @@ /*! - * Datepicker v1.0.2 + * Datepicker v1.0.3 * https://fengyuanchen.github.io/datepicker * * Copyright 2014-present Chen Fengyuan * Released under the MIT license * - * Date: 2018-12-15T03:52:10.525Z + * Date: 2018-12-20T12:51:42.329Z */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):t(e.jQuery)}(this,function(D){"use strict";function s(e,t){for(var i=0;i
',offset:10,zIndex:1e3,filter:null,show:null,hide:null,pick:null},e="undefined"!=typeof window?window:{},d="datepicker",r="click.".concat(d),h="focus.".concat(d),o="hide.".concat(d),l="keyup.".concat(d),c="pick.".concat(d),t="resize.".concat(d),i="scroll.".concat(d),u="show.".concat(d),p="".concat(d,"-hide"),f={},g=0,y=1,v=2,a=Object.prototype.toString;function m(e){return"string"==typeof e}var w=Number.isNaN||e.isNaN;function k(e){return"number"==typeof e&&!w(e)}function b(e){return void 0===e}function C(e){return"date"===(t=e,a.call(t).slice(8,-1).toLowerCase())&&!w(e.getTime());var t}function $(a,s){for(var e=arguments.length,n=new Array(2a.getFullYear(),6===e&&(u=f)),!f&&n&&(f=!1===n.call(this.$element,p,"year"));var g=h+e===l,y=g?"year picked":"year";d.push(this.createItem({picked:g,disabled:f,text:h+e,view:f?"year disabled":y,highlighted:p.getFullYear()===o}))}this.$yearsPrev.toggleClass(s,c),this.$yearsNext.toggleClass(s,u),this.$yearsCurrent.toggleClass(s,!0).html("".concat(h+-5+r," - ").concat(h+6).concat(r)),this.$years.html(d.join(""))},renderMonths:function(){var e,t=this.options,i=this.startDate,a=this.endDate,s=this.viewDate,n=t.disabledClass||"",r=t.monthsShort,h=D.isFunction(t.filter)&&t.filter,o=s.getFullYear(),l=new Date,d=l.getFullYear(),c=l.getMonth(),u=this.date.getFullYear(),p=this.date.getMonth(),f=[],g=!1,y=!1;for(e=0;e<=11;e+=1){var v=new Date(o,e,1),m=!1;i&&(m=(g=v.getFullYear()===i.getFullYear())&&v.getMonth()a.getMonth()),!m&&h&&(m=!1===h.call(this.$element,v,"month"));var w=o===u&&e===p,k=w?"month picked":"month";f.push(this.createItem({disabled:m,picked:w,highlighted:o===d&&v.getMonth()===c,index:e,text:r[e],view:m?"month disabled":k}))}this.$yearPrev.toggleClass(n,g),this.$yearNext.toggleClass(n,y),this.$yearCurrent.toggleClass(n,g&&y).html(o+t.yearSuffix||""),this.$months.html(f.join(""))},renderDays:function(){var e,t,i,a=this.$element,s=this.options,n=this.startDate,r=this.endDate,h=this.viewDate,o=this.date,l=s.disabledClass,d=s.filter,c=s.months,u=s.weekStart,p=s.yearSuffix,f=h.getFullYear(),g=h.getMonth(),y=new Date,v=y.getFullYear(),m=y.getMonth(),w=y.getDate(),k=o.getFullYear(),D=o.getMonth(),b=o.getDate(),C=[],$=f,x=g,F=!1;0===g?($-=1,x=11):x-=1,e=G($,x);var M=new Date(f,g,1);for((i=M.getDay()-parseInt(u,10)%7)<=0&&(i+=7),n&&(F=M.getTime()<=n.getTime()),t=e-(i-1);t<=e;t+=1){var Y=new Date($,x,t),V=!1;n&&(V=Y.getTime()=r.getTime()),t=1;t<=i;t+=1){var j=new Date(I,S,t),q=I===k&&S===D&&t===b,A=!1;r&&(A=j.getTime()>r.getTime()),!A&&d&&(A=!1===d.call(a,j,"day")),T.push(this.createItem({disabled:A,picked:q,highlighted:I===v&&S===m&&j.getDate()===w,muted:!0,text:t,view:"day next"}))}var O=[];for(t=1;t<=e;t+=1){var W=new Date(f,g,t),z=!1;n&&(z=W.getTime()r.getTime()),!z&&d&&(z=!1===d.call(a,W,"day"));var J=f===k&&g===D&&t===b,E=J?"day picked":"day";O.push(this.createItem({disabled:z,picked:J,highlighted:f===v&&g===m&&W.getDate()===w,text:t,view:z?"day disabled":E}))}this.$monthPrev.toggleClass(l,F),this.$monthNext.toggleClass(l,P),this.$monthCurrent.toggleClass(l,F&&P).html(s.yearFirst?"".concat(f+p," ").concat(c[g]):"".concat(c[g]," ").concat(f).concat(p)),this.$days.html(C.join("")+O.join("")+T.join(""))}},P="".concat(d,"-top-left"),N="".concat(d,"-top-right"),j="".concat(d,"-bottom-left"),q="".concat(d,"-bottom-right"),A=[P,N,j,q].join(" "),O=function(){function i(e){var t=1a.getTime()&&(s=new Date(a)),this.endDate=a),this.date=s,this.viewDate=new Date(s),this.initialDate=new Date(this.date),this.bind(),(t.autoShow||this.inline)&&this.show(),t.autoPick&&this.pick()}},{key:"build",value:function(){if(!this.built){this.built=!0;var e=this.$element,t=this.options,i=D(t.template);this.$picker=i,this.$week=i.find(x("week")),this.$yearsPicker=i.find(x("years picker")),this.$yearsPrev=i.find(x("years prev")),this.$yearsNext=i.find(x("years next")),this.$yearsCurrent=i.find(x("years current")),this.$years=i.find(x("years")),this.$monthsPicker=i.find(x("months picker")),this.$yearPrev=i.find(x("year prev")),this.$yearNext=i.find(x("year next")),this.$yearCurrent=i.find(x("year current")),this.$months=i.find(x("months")),this.$daysPicker=i.find(x("days picker")),this.$monthPrev=i.find(x("month prev")),this.$monthNext=i.find(x("month next")),this.$monthCurrent=i.find(x("month current")),this.$days=i.find(x("days")),this.inline?D(t.container||e).append(i.addClass("".concat(d,"-inline"))):(D(document.body).append(i.addClass("".concat(d,"-dropdown"))),i.addClass(p).css({zIndex:parseInt(t.zIndex,10)})),this.renderWeek()}}},{key:"unbuild",value:function(){this.built&&(this.built=!1,this.$picker.remove())}},{key:"bind",value:function(){var e=this.options,t=this.$element;D.isFunction(e.show)&&t.on(u,e.show),D.isFunction(e.hide)&&t.on(o,e.hide),D.isFunction(e.pick)&&t.on(c,e.pick),this.isInput&&t.on(l,D.proxy(this.keyup,this)),this.inline||(e.trigger?this.$trigger.on(r,D.proxy(this.toggle,this)):this.isInput?t.on(h,D.proxy(this.show,this)):t.on(r,D.proxy(this.show,this)))}},{key:"unbind",value:function(){var e=this.$element,t=this.options;D.isFunction(t.show)&&e.off(u,t.show),D.isFunction(t.hide)&&e.off(o,t.hide),D.isFunction(t.pick)&&e.off(c,t.pick),this.isInput&&e.off(l,this.keyup),this.inline||(t.trigger?this.$trigger.off(r,this.toggle):this.isInput?e.off(h,this.show):e.off(r,this.show))}},{key:"showView",value:function(e){var t=this.$yearsPicker,i=this.$monthsPicker,a=this.$daysPicker,s=this.format;if(s.hasYear||s.hasMonth||s.hasDay)switch(Number(e)){case v:i.addClass(p),a.addClass(p),s.hasYear?(this.renderYears(),t.removeClass(p),this.place()):this.showView(g);break;case y:t.addClass(p),a.addClass(p),s.hasMonth?(this.renderMonths(),i.removeClass(p),this.place()):this.showView(v);break;default:t.addClass(p),i.addClass(p),s.hasDay?(this.renderDays(),a.removeClass(p),this.place()):this.showView(y)}}},{key:"hideView",value:function(){!this.inline&&this.options.autoHide&&this.hide()}},{key:"place",value:function(){if(!this.inline){var e=this.$element,t=this.options,i=this.$picker,a=D(document).outerWidth(),s=D(document).outerHeight(),n=e.outerWidth(),r=e.outerHeight(),h=i.width(),o=i.height(),l=e.offset(),d=l.left,c=l.top,u=parseFloat(t.offset),p=P;w(u)&&(u=10),o').concat(a.text,"")}},{key:"getValue",value:function(){var e=this.$element;return this.isInput?e.val():e.text()}},{key:"setValue",value:function(){var e=0
          ',offset:10,zIndex:1e3,filter:null,show:null,hide:null,pick:null},e="undefined"!=typeof window?window:{},d="datepicker",r="click.".concat(d),h="focus.".concat(d),o="hide.".concat(d),l="keyup.".concat(d),c="pick.".concat(d),t="resize.".concat(d),i="scroll.".concat(d),u="show.".concat(d),p="".concat(d,"-hide"),f={},g=0,y=1,v=2,a=Object.prototype.toString;function m(e){return"string"==typeof e}var w=Number.isNaN||e.isNaN;function k(e){return"number"==typeof e&&!w(e)}function b(e){return void 0===e}function C(e){return"date"===(t=e,a.call(t).slice(8,-1).toLowerCase())&&!w(e.getTime());var t}function $(a,s){for(var e=arguments.length,n=new Array(2a.getFullYear(),6===e&&(u=f)),!f&&n&&(f=!1===n.call(this.$element,p,"year"));var g=h+e===l,y=g?"year picked":"year";d.push(this.createItem({picked:g,disabled:f,text:h+e,view:f?"year disabled":y,highlighted:p.getFullYear()===o}))}this.$yearsPrev.toggleClass(s,c),this.$yearsNext.toggleClass(s,u),this.$yearsCurrent.toggleClass(s,!0).html("".concat(h+-5+r," - ").concat(h+6).concat(r)),this.$years.html(d.join(""))},renderMonths:function(){var e,t=this.options,i=this.startDate,a=this.endDate,s=this.viewDate,n=t.disabledClass||"",r=t.monthsShort,h=D.isFunction(t.filter)&&t.filter,o=s.getFullYear(),l=new Date,d=l.getFullYear(),c=l.getMonth(),u=this.date.getFullYear(),p=this.date.getMonth(),f=[],g=!1,y=!1;for(e=0;e<=11;e+=1){var v=new Date(o,e,1),m=!1;i&&(m=(g=v.getFullYear()===i.getFullYear())&&v.getMonth()a.getMonth()),!m&&h&&(m=!1===h.call(this.$element,v,"month"));var w=o===u&&e===p,k=w?"month picked":"month";f.push(this.createItem({disabled:m,picked:w,highlighted:o===d&&v.getMonth()===c,index:e,text:r[e],view:m?"month disabled":k}))}this.$yearPrev.toggleClass(n,g),this.$yearNext.toggleClass(n,y),this.$yearCurrent.toggleClass(n,g&&y).html(o+t.yearSuffix||""),this.$months.html(f.join(""))},renderDays:function(){var e,t,i,a=this.$element,s=this.options,n=this.startDate,r=this.endDate,h=this.viewDate,o=this.date,l=s.disabledClass,d=s.filter,c=s.months,u=s.weekStart,p=s.yearSuffix,f=h.getFullYear(),g=h.getMonth(),y=new Date,v=y.getFullYear(),m=y.getMonth(),w=y.getDate(),k=o.getFullYear(),D=o.getMonth(),b=o.getDate(),C=[],$=f,x=g,F=!1;0===g?($-=1,x=11):x-=1,e=G($,x);var M=new Date(f,g,1);for((i=M.getDay()-parseInt(u,10)%7)<=0&&(i+=7),n&&(F=M.getTime()<=n.getTime()),t=e-(i-1);t<=e;t+=1){var Y=new Date($,x,t),V=!1;n&&(V=Y.getTime()=r.getTime()),t=1;t<=i;t+=1){var j=new Date(I,S,t),q=I===k&&S===D&&t===b,A=!1;r&&(A=j.getTime()>r.getTime()),!A&&d&&(A=!1===d.call(a,j,"day")),T.push(this.createItem({disabled:A,picked:q,highlighted:I===v&&S===m&&j.getDate()===w,muted:!0,text:t,view:"day next"}))}var O=[];for(t=1;t<=e;t+=1){var W=new Date(f,g,t),z=!1;n&&(z=W.getTime()r.getTime()),!z&&d&&(z=!1===d.call(a,W,"day"));var J=f===k&&g===D&&t===b,E=J?"day picked":"day";O.push(this.createItem({disabled:z,picked:J,highlighted:f===v&&g===m&&W.getDate()===w,text:t,view:z?"day disabled":E}))}this.$monthPrev.toggleClass(l,F),this.$monthNext.toggleClass(l,P),this.$monthCurrent.toggleClass(l,F&&P).html(s.yearFirst?"".concat(f+p," ").concat(c[g]):"".concat(c[g]," ").concat(f).concat(p)),this.$days.html(C.join("")+O.join("")+T.join(""))}},P="".concat(d,"-top-left"),N="".concat(d,"-top-right"),j="".concat(d,"-bottom-left"),q="".concat(d,"-bottom-right"),A=[P,N,j,q].join(" "),O=function(){function i(e){var t=1a.getTime()&&(s=new Date(a)),this.endDate=a),this.date=s,this.viewDate=new Date(s),this.initialDate=new Date(this.date),this.bind(),(t.autoShow||this.inline)&&this.show(),t.autoPick&&this.pick()}},{key:"build",value:function(){if(!this.built){this.built=!0;var e=this.$element,t=this.options,i=D(t.template);this.$picker=i,this.$week=i.find(x("week")),this.$yearsPicker=i.find(x("years picker")),this.$yearsPrev=i.find(x("years prev")),this.$yearsNext=i.find(x("years next")),this.$yearsCurrent=i.find(x("years current")),this.$years=i.find(x("years")),this.$monthsPicker=i.find(x("months picker")),this.$yearPrev=i.find(x("year prev")),this.$yearNext=i.find(x("year next")),this.$yearCurrent=i.find(x("year current")),this.$months=i.find(x("months")),this.$daysPicker=i.find(x("days picker")),this.$monthPrev=i.find(x("month prev")),this.$monthNext=i.find(x("month next")),this.$monthCurrent=i.find(x("month current")),this.$days=i.find(x("days")),this.inline?D(t.container||e).append(i.addClass("".concat(d,"-inline"))):(D(document.body).append(i.addClass("".concat(d,"-dropdown"))),i.addClass(p).css({zIndex:parseInt(t.zIndex,10)})),this.renderWeek()}}},{key:"unbuild",value:function(){this.built&&(this.built=!1,this.$picker.remove())}},{key:"bind",value:function(){var e=this.options,t=this.$element;D.isFunction(e.show)&&t.on(u,e.show),D.isFunction(e.hide)&&t.on(o,e.hide),D.isFunction(e.pick)&&t.on(c,e.pick),this.isInput&&t.on(l,D.proxy(this.keyup,this)),this.inline||(e.trigger?this.$trigger.on(r,D.proxy(this.toggle,this)):this.isInput?t.on(h,D.proxy(this.show,this)):t.on(r,D.proxy(this.show,this)))}},{key:"unbind",value:function(){var e=this.$element,t=this.options;D.isFunction(t.show)&&e.off(u,t.show),D.isFunction(t.hide)&&e.off(o,t.hide),D.isFunction(t.pick)&&e.off(c,t.pick),this.isInput&&e.off(l,this.keyup),this.inline||(t.trigger?this.$trigger.off(r,this.toggle):this.isInput?e.off(h,this.show):e.off(r,this.show))}},{key:"showView",value:function(e){var t=this.$yearsPicker,i=this.$monthsPicker,a=this.$daysPicker,s=this.format;if(s.hasYear||s.hasMonth||s.hasDay)switch(Number(e)){case v:i.addClass(p),a.addClass(p),s.hasYear?(this.renderYears(),t.removeClass(p),this.place()):this.showView(g);break;case y:t.addClass(p),a.addClass(p),s.hasMonth?(this.renderMonths(),i.removeClass(p),this.place()):this.showView(v);break;default:t.addClass(p),i.addClass(p),s.hasDay?(this.renderDays(),a.removeClass(p),this.place()):this.showView(y)}}},{key:"hideView",value:function(){!this.inline&&this.options.autoHide&&this.hide()}},{key:"place",value:function(){if(!this.inline){var e=this.$element,t=this.options,i=this.$picker,a=D(document).outerWidth(),s=D(document).outerHeight(),n=e.outerWidth(),r=e.outerHeight(),h=i.width(),o=i.height(),l=e.offset(),d=l.left,c=l.top,u=parseFloat(t.offset),p=P;w(u)&&(u=10),o').concat(a.text,"")}},{key:"getValue",value:function(){var e=this.$element;return this.isInput?e.val():e.text()}},{key:"setValue",value:function(){var e=0
          -

          Datepicker v1.0.2

          +

          Datepicker v1.0.3

          A simple jQuery datepicker plugin.

          diff --git a/docs/js/datepicker.js b/docs/js/datepicker.js index 0074e1f..d5f04ba 100644 --- a/docs/js/datepicker.js +++ b/docs/js/datepicker.js @@ -1,18 +1,18 @@ /*! - * Datepicker v1.0.2 + * Datepicker v1.0.3 * https://fengyuanchen.github.io/datepicker * * Copyright 2014-present Chen Fengyuan * Released under the MIT license * - * Date: 2018-12-15T03:52:10.525Z + * Date: 2018-12-20T12:51:42.329Z */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : typeof define === 'function' && define.amd ? define(['jquery'], factory) : - (factory(global.jQuery)); -}(this, (function ($) { 'use strict'; + (global = global || self, factory(global.jQuery)); +}(this, function ($) { 'use strict'; $ = $ && $.hasOwnProperty('default') ? $['default'] : $; @@ -486,50 +486,49 @@ var format = this.format; var parts = []; - if (isDate(date)) { - return new Date(date.getFullYear(), date.getMonth(), date.getDate()); - } + if (!isDate(date)) { + if (isString(date)) { + parts = date.match(REGEXP_DIGITS) || []; + } - if (isString(date)) { - parts = date.match(REGEXP_DIGITS) || []; - } + date = date ? new Date(date) : new Date(); - var parsedDate = date ? new Date(date) : new Date(); + if (!isDate(date)) { + date = new Date(); + } - if (!isDate(parsedDate)) { - parsedDate = new Date(); - } + if (parts.length === format.parts.length) { + $.each(parts, function (i, part) { + var value = parseInt(part, 10); - if (parts.length === format.parts.length) { - $.each(parts, function (i, part) { - var value = parseInt(part, 10); + switch (format.parts[i]) { + case 'dd': + case 'd': + date.setDate(value); + break; - switch (format.parts[i]) { - case 'dd': - case 'd': - parsedDate.setDate(value); - break; + case 'mm': + case 'm': + date.setMonth(value - 1); + break; - case 'mm': - case 'm': - parsedDate.setMonth(value - 1); - break; + case 'yy': + date.setFullYear(2000 + value); + break; - case 'yy': - parsedDate.setFullYear(2000 + value); - break; + case 'yyyy': + // Converts 2-digit year to 2000+ + date.setFullYear(part.length === 2 ? 2000 + value : value); + break; - case 'yyyy': - // Converts 2-digit year to 2000+ - parsedDate.setFullYear(part.length === 2 ? 2000 + value : value); - break; + default: + } + }); + } + } // Ignore hours, minutes, seconds and milliseconds to avoid side effect (#192) - default: - } - }); - } - return parsedDate; + return new Date(date.getFullYear(), date.getMonth(), date.getDate()); }, /** @@ -708,8 +707,10 @@ } viewDay = parseInt($target.text(), 10); + date.setFullYear(viewYear); date.setMonth(viewMonth); date.setDate(viewDay); + viewDate.setFullYear(viewYear); viewDate.setMonth(viewMonth); viewDate.setDate(viewDay); this.renderDays(); @@ -1493,4 +1494,4 @@ }; } -}))); +})); diff --git a/package-lock.json b/package-lock.json index 10620bd..93a31e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@chenfengyuan/datepicker", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -14,18 +14,18 @@ } }, "@babel/core": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.2.0.tgz", - "integrity": "sha512-7pvAdC4B+iKjFFp9Ztj0QgBndJ++qaMeonT185wAqUnhipw8idm9Rv1UMyBuKtYjfl6ORNkgEgcsYLfHX/GpLw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.2.2.tgz", + "integrity": "sha512-59vB0RWt09cAct5EIe58+NzGP4TFSD3Bz//2/ELy3ZeTeKF6VTD1AXlH8BGGbCX0PuobZBsIzO7IAI9PH67eKw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.2.0", + "@babel/generator": "^7.2.2", "@babel/helpers": "^7.2.0", - "@babel/parser": "^7.2.0", - "@babel/template": "^7.1.2", - "@babel/traverse": "^7.1.6", - "@babel/types": "^7.2.0", + "@babel/parser": "^7.2.2", + "@babel/template": "^7.2.2", + "@babel/traverse": "^7.2.2", + "@babel/types": "^7.2.2", "convert-source-map": "^1.1.0", "debug": "^4.1.0", "json5": "^2.1.0", @@ -33,19 +33,45 @@ "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" + }, + "dependencies": { + "@babel/types": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.2.tgz", + "integrity": "sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.10", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/generator": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.2.0.tgz", - "integrity": "sha512-BA75MVfRlFQG2EZgFYIwyT1r6xSkwfP2bdkY/kLZusEYWiJs4xCowab/alaEaT0wSvmVuXGqiefeBlP+7V1yKg==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.2.2.tgz", + "integrity": "sha512-I4o675J/iS8k+P38dvJ3IBGqObLXyQLTxtrR4u9cSUJOURvafeEWb/pFMOTwtNrmq73mJzyF6ueTbO1BtN0Zeg==", "dev": true, "requires": { - "@babel/types": "^7.2.0", + "@babel/types": "^7.2.2", "jsesc": "^2.5.1", "lodash": "^4.17.10", "source-map": "^0.5.0", "trim-right": "^1.0.1" + }, + "dependencies": { + "@babel/types": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.2.tgz", + "integrity": "sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.10", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/helper-annotate-as-pure": { @@ -147,17 +173,30 @@ } }, "@babel/helper-module-transforms": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.1.0.tgz", - "integrity": "sha512-0JZRd2yhawo79Rcm4w0LwSMILFmFXjugG3yqf+P/UsKsRS1mJCmMwwlHDlMg7Avr9LrvSpp4ZSULO9r8jpCzcw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.2.2.tgz", + "integrity": "sha512-YRD7I6Wsv+IHuTPkAmAS4HhY0dkPobgLftHp0cRGZSdrRvmZY8rFvae/GVu3bD00qscuvK3WPHB3YdNpBXUqrA==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.0.0", "@babel/helper-simple-access": "^7.1.0", "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0", + "@babel/template": "^7.2.2", + "@babel/types": "^7.2.2", "lodash": "^4.17.10" + }, + "dependencies": { + "@babel/types": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.2.tgz", + "integrity": "sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.10", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/helper-optimise-call-expression": { @@ -198,14 +237,14 @@ } }, "@babel/helper-replace-supers": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.1.0.tgz", - "integrity": "sha512-BvcDWYZRWVuDeXTYZWxekQNO5D4kO55aArwZOTFXw6rlLQA8ZaDicJR1sO47h+HrnCiDFiww0fSPV0d713KBGQ==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.2.3.tgz", + "integrity": "sha512-GyieIznGUfPXPWu0yLS6U55Mz67AZD9cUk0BfirOWlPrXlBcan9Gz+vHGz+cPfuoweZSnPzPIm67VtQM0OWZbA==", "dev": true, "requires": { "@babel/helper-member-expression-to-functions": "^7.0.0", "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/traverse": "^7.1.0", + "@babel/traverse": "^7.2.3", "@babel/types": "^7.0.0" } }, @@ -263,9 +302,9 @@ } }, "@babel/parser": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.2.0.tgz", - "integrity": "sha512-M74+GvK4hn1eejD9lZ7967qAwvqTZayQa3g10ag4s9uewgR7TKjeaT0YMyoq+gVfKYABiWZ4MQD701/t5e1Jhg==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.2.3.tgz", + "integrity": "sha512-0LyEcVlfCoFmci8mXx8A5oIkpkOgyo8dRHtxBnK9RRBwxO2+JZPNsqtVEZQ7mJFPxnXF9lfmU24mHOPI0qnlkA==", "dev": true }, "@babel/plugin-proposal-async-generator-functions": { @@ -396,9 +435,9 @@ } }, "@babel/plugin-transform-classes": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.2.0.tgz", - "integrity": "sha512-aPCEkrhJYebDXcGTAP+cdUENkH7zqOlgbKwLbghjjHpJRJBWM/FSlCjMoPGA8oUdiMfOrk3+8EFPLLb5r7zj2w==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.2.2.tgz", + "integrity": "sha512-gEZvgTy1VtcDOaQty1l10T3jQmJKlNVxLDCs+3rCVPr6nMkODLELxViq5X9l+rfxbie3XrfrMCYYY6eX3aOcOQ==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.0.0", @@ -577,9 +616,9 @@ } }, "@babel/plugin-transform-spread": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.0.tgz", - "integrity": "sha512-7TtPIdwjS/i5ZBlNiQePQCovDh9pAhVbp/nGVRBZuUdBiVRThyyLend3OHobc0G+RLCPPAN70+z/MAMhsgJd/A==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz", + "integrity": "sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" @@ -626,9 +665,9 @@ } }, "@babel/preset-env": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.2.0.tgz", - "integrity": "sha512-haGR38j5vOGVeBatrQPr3l0xHbs14505DcM57cbJy48kgMFvvHHoYEhHuRV+7vi559yyAUAVbTWzbK/B/pzJng==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.2.3.tgz", + "integrity": "sha512-AuHzW7a9rbv5WXmvGaPX7wADxFkZIqKlbBh1dmZUQp4iwiPpkE/Qnrji6SC4UQCQzvWY/cpHET29eUhXS9cLPw==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.0.0", @@ -675,31 +714,57 @@ } }, "@babel/template": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.2.tgz", - "integrity": "sha512-SY1MmplssORfFiLDcOETrW7fCLl+PavlwMh92rrGcikQaRq4iWPVH0MpwPpY3etVMx6RnDjXtr6VZYr/IbP/Ag==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.2.2.tgz", + "integrity": "sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.1.2", - "@babel/types": "^7.1.2" + "@babel/parser": "^7.2.2", + "@babel/types": "^7.2.2" + }, + "dependencies": { + "@babel/types": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.2.tgz", + "integrity": "sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.10", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/traverse": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.1.6.tgz", - "integrity": "sha512-CXedit6GpISz3sC2k2FsGCUpOhUqKdyL0lqNrImQojagnUMXf8hex4AxYFRuMkNGcvJX5QAFGzB5WJQmSv8SiQ==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.2.3.tgz", + "integrity": "sha512-Z31oUD/fJvEWVR0lNZtfgvVt512ForCTNKYcJBGbPb1QZfve4WGH8Wsy7+Mev33/45fhP/hwQtvgusNdcCMgSw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.1.6", + "@babel/generator": "^7.2.2", "@babel/helper-function-name": "^7.1.0", "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/parser": "^7.1.6", - "@babel/types": "^7.1.6", + "@babel/parser": "^7.2.3", + "@babel/types": "^7.2.2", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.10" + }, + "dependencies": { + "@babel/types": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.2.tgz", + "integrity": "sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.10", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/types": { @@ -1018,9 +1083,9 @@ "dev": true }, "@types/node": { - "version": "10.12.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.12.tgz", - "integrity": "sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A==", + "version": "10.12.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz", + "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==", "dev": true }, "@types/unist": { @@ -1245,17 +1310,51 @@ "dev": true }, "autoprefixer": { - "version": "9.4.2", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.4.2.tgz", - "integrity": "sha512-tYQYJvZvqlJCzF+BLC//uAcdT/Yy4ik9bwZRXr/EehUJ/bjjpTthsWTy8dpowdoIE1sLCDf1ch4Eb2cOSzZC9w==", + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.4.3.tgz", + "integrity": "sha512-/XSnzDepRkAU//xLcXA/lUWxpsBuw0WiriAHOqnxkuCtzLhaz+fL4it4gp20BQ8n5SyLzK/FOc7A0+u/rti2FQ==", "dev": true, "requires": { - "browserslist": "^4.3.5", - "caniuse-lite": "^1.0.30000914", + "browserslist": "^4.3.6", + "caniuse-lite": "^1.0.30000921", "normalize-range": "^0.1.2", "num2fraction": "^1.2.2", "postcss": "^7.0.6", "postcss-value-parser": "^3.3.1" + }, + "dependencies": { + "browserslist": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.3.6.tgz", + "integrity": "sha512-kMGKs4BTzRWviZ8yru18xBpx+CyHG9eqgRbj9XbE3IMgtczf4aiA0Y1YCpVdvUieKGZ03kolSPXqTcscBCb9qw==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000921", + "electron-to-chromium": "^1.3.92", + "node-releases": "^1.1.1" + } + }, + "caniuse-lite": { + "version": "1.0.30000923", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000923.tgz", + "integrity": "sha512-j5ur7eeluOFjjPUkydtXP4KFAsmH3XaQNch5tvWSO+dLHYt5PE+VgJZLWtbVOodfWij6m6zas28T4gB/cLYq1w==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.95", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.95.tgz", + "integrity": "sha512-0JZEDKOQAE05EO/4rk3vLAE+PYFI9OLCVLAS4QAq1y+Bb2y1N6MyQJz62ynzHN/y0Ka/nO5jVJcahbCEdfiXLQ==", + "dev": true + }, + "node-releases": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.2.tgz", + "integrity": "sha512-j1gEV/zX821yxdWp/1vBMN0pSUjuH9oGUdLCb4PfUko6ZW7KdRs3Z+QGGwDUhYtSpQvdVVyLd2V0YvLsmdg5jQ==", + "dev": true, + "requires": { + "semver": "^5.3.0" + } + } } }, "aws-sign2": { @@ -3003,9 +3102,9 @@ "dev": true }, "dependency-graph": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.7.2.tgz", - "integrity": "sha512-KqtH4/EZdtdfWX0p6MGP9jljvxSY6msy/pRUD4jgNwVpv3v1QmNLlsB3LDSSUg79BRVSn7jI1QPRtArGABovAQ==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.8.0.tgz", + "integrity": "sha512-DCvzSq2UiMsuLnj/9AL484ummEgLtZIcRS7YvtO38QnpX3vqh9nJ8P+zhu8Ja+SmLrBHO2iDbva20jq38qvBkQ==", "dev": true }, "detect-indent": { @@ -4959,9 +5058,9 @@ } }, "husky": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/husky/-/husky-1.2.1.tgz", - "integrity": "sha512-4Ylal3HWhnDvIszuiyLoVrSGI7QLg/ogkNCoHE34c+yZYzb9kBZNrlTOsdw92cGi3cJT8pPb6CdVfxFkLnc8Dg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/husky/-/husky-1.3.0.tgz", + "integrity": "sha512-0Yfh4PkWr8Nrume/lEMgSgK5zg8Q19jGM7jDmN7H92VrqgcYSbn+CM1iLGmAvQSNWuaPx9iq/rq/4Y8LPX6dLA==", "dev": true, "requires": { "cosmiconfig": "^5.0.7", @@ -7369,14 +7468,14 @@ } }, "postcss-cli": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/postcss-cli/-/postcss-cli-6.0.1.tgz", - "integrity": "sha512-M9GiEMzXVMlI4ln8e+mdeHT+qvoHVZdlN06hj5/EhrRZWDr+J1sniPeGJ4nghknl+du3Oj2UoqqhgpKKhiZ9+w==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/postcss-cli/-/postcss-cli-6.1.0.tgz", + "integrity": "sha512-qXufMvDOvD0fvcnDYO6Rz85nSmXjIDpx2IP8CzrGv8RxAfxx5Zjvfx1GGXxbOyk8terq1Q1O8GL4ZTzBuZ1TYg==", "dev": true, "requires": { "chalk": "^2.1.0", "chokidar": "^2.0.0", - "dependency-graph": "^0.7.0", + "dependency-graph": "^0.8.0", "fs-extra": "^7.0.0", "get-stdin": "^6.0.0", "globby": "^8.0.0", @@ -8521,15 +8620,15 @@ "dev": true }, "regexpu-core": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.2.0.tgz", - "integrity": "sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.4.0.tgz", + "integrity": "sha512-eDDWElbwwI3K0Lo6CqbQbA6FwgtCz4kYTarrri1okfkRLZAqstU+B3voZBCjg8Fl6iq0gXrJG6MvRgLthfvgOA==", "dev": true, "requires": { "regenerate": "^1.4.0", "regenerate-unicode-properties": "^7.0.0", - "regjsgen": "^0.4.0", - "regjsparser": "^0.3.0", + "regjsgen": "^0.5.0", + "regjsparser": "^0.6.0", "unicode-match-property-ecmascript": "^1.0.4", "unicode-match-property-value-ecmascript": "^1.0.2" } @@ -8554,15 +8653,15 @@ } }, "regjsgen": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.4.0.tgz", - "integrity": "sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.0.tgz", + "integrity": "sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA==", "dev": true }, "regjsparser": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.3.0.tgz", - "integrity": "sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.0.tgz", + "integrity": "sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ==", "dev": true, "requires": { "jsesc": "~0.5.0" @@ -8822,9 +8921,9 @@ } }, "rollup": { - "version": "0.67.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.67.4.tgz", - "integrity": "sha512-AVuP73mkb4BBMUmksQ3Jw0jTrBTU1i7rLiUYjFxLZGb3xiFmtVEg40oByphkZAsiL0bJC3hRAJUQos/e5EBd+w==", + "version": "0.68.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.68.1.tgz", + "integrity": "sha512-8DNKos2p/B7gDoxI42kyIHHX8d+Zt+bwhjUgXnTqnSP+CSPkRNNIQyHIcTqeGdYWR70qG6c1DaRcrjWAiG6Akg==", "dev": true, "requires": { "@types/estree": "0.0.39", diff --git a/package.json b/package.json index 83cb5e8..4667ad5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@chenfengyuan/datepicker", "description": "A simple jQuery datepicker plugin.", - "version": "1.0.2", + "version": "1.0.3", "main": "dist/datepicker.common.js", "module": "dist/datepicker.esm.js", "unpkg": "dist/datepicker.js", @@ -51,11 +51,11 @@ "watch:js": "rollup -c -m -w" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/preset-env": "^7.2.0", + "@babel/core": "^7.2.2", + "@babel/preset-env": "^7.2.3", "@commitlint/cli": "^7.2.1", "@commitlint/config-conventional": "^7.1.2", - "autoprefixer": "^9.4.2", + "autoprefixer": "^9.4.3", "cpy-cli": "^2.0.0", "create-banner": "^1.0.0", "cssnano": "^4.1.7", @@ -63,16 +63,16 @@ "eslint": "^5.10.0", "eslint-config-airbnb-base": "^13.1.0", "eslint-plugin-import": "^2.14.0", - "husky": "^1.2.1", + "husky": "^1.3.0", "jquery": "^3.3.1", "lint-staged": "^8.1.0", "node-qunit-phantomjs": "^2.0.1", "npm-run-all": "^4.1.5", - "postcss-cli": "^6.0.1", + "postcss-cli": "^6.1.0", "postcss-header": "^1.0.0", "postcss-import": "^12.0.1", "postcss-preset-env": "^6.5.0", - "rollup": "^0.67.4", + "rollup": "^0.68.1", "rollup-plugin-babel": "^4.1.0", "rollup-plugin-commonjs": "^9.2.0", "rollup-plugin-node-resolve": "^4.0.0", @@ -84,5 +84,8 @@ }, "peerDependencies": { "jquery": ">= 1.9.1" + }, + "publishConfig": { + "access": "public" } }