Comparing version 1.9.3 to 1.9.4
@@ -0,1 +1,16 @@ | ||
## [1.9.4](https://github.com/iamkun/dayjs/compare/v1.9.3...v1.9.4) (2020-10-23) | ||
### Bug Fixes | ||
* Add descriptions to types ([#1148](https://github.com/iamkun/dayjs/issues/1148)) ([9a407a1](https://github.com/iamkun/dayjs/commit/9a407a140b089345a387d1aceab4d0d1635229c7)) | ||
* add devHelper plugin ([#1163](https://github.com/iamkun/dayjs/issues/1163)) ([de49dc8](https://github.com/iamkun/dayjs/commit/de49dc80c83b85de4170571b64412bd60ada221b)) | ||
* Fix Hungarian (hu) locale ([#1112](https://github.com/iamkun/dayjs/issues/1112)) ([ab13754](https://github.com/iamkun/dayjs/commit/ab13754f43c5033dacaa0eb2042dc4ab1a7a2754)) | ||
* fix minMax plugin parsing empty array bug ([#1062](https://github.com/iamkun/dayjs/issues/1062)) ([368108b](https://github.com/iamkun/dayjs/commit/368108bc6d5cb1542f711b8eba722bd4dfaab0cd)) | ||
* update adding/subtracting Duration from Dayjs object ([#1156](https://github.com/iamkun/dayjs/issues/1156)) ([f861aca](https://github.com/iamkun/dayjs/commit/f861acac3e83e28d3a4a96312c71119fd6b544fc)) | ||
* update en-NZ locale to use proper ordinal formatting function ([#1143](https://github.com/iamkun/dayjs/issues/1143)) ([fcdbc58](https://github.com/iamkun/dayjs/commit/fcdbc5880710456a29b2bacf250542230bf48b99)) | ||
* update localeData plugin type ([#1116](https://github.com/iamkun/dayjs/issues/1116)) ([ee5a4ec](https://github.com/iamkun/dayjs/commit/ee5a4ec41edddfb57d103c35182dc635c9264a10)) | ||
* update timezone plugin to support custom parse format ([#1160](https://github.com/iamkun/dayjs/issues/1160)) ([48cbf31](https://github.com/iamkun/dayjs/commit/48cbf3118ba5427de428777c2e025896db654f2e)), closes [#1159](https://github.com/iamkun/dayjs/issues/1159) | ||
* update timezone plugin to support keepLocalTime ([#1161](https://github.com/iamkun/dayjs/issues/1161)) ([1d429e5](https://github.com/iamkun/dayjs/commit/1d429e5fe4467ebddcf81b43cf6f36e5e3be944c)), closes [#1149](https://github.com/iamkun/dayjs/issues/1149) | ||
## [1.9.3](https://github.com/iamkun/dayjs/compare/v1.9.2...v1.9.3) (2020-10-13) | ||
@@ -2,0 +17,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.dayjs=e()}(this,function(){"use strict";var t="millisecond",e="second",n="minute",r="hour",i="day",s="week",u="month",a="quarter",o="year",f="date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d+)?$/,c=/\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},$=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},l={s:$,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+$(r,2,"0")+":"+$(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,u),s=n-i<0,a=e.clone().add(r+(s?-1:1),u);return+(-(r+(n-i)/(s?i-a:a-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(h){return{M:u,y:o,w:s,d:i,D:f,h:r,m:n,s:e,ms:t,Q:a}[h]||String(h||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},y="en",M={};M[y]=d;var m=function(t){return t instanceof S},D=function(t,e,n){var r;if(!t)return y;if("string"==typeof t)M[t]&&(r=t),e&&(M[t]=e,r=t);else{var i=t.name;M[i]=t,r=i}return!n&&r&&(y=r),r||!n&&y},v=function(t,e){if(m(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new S(n)},g=l;g.l=D,g.i=m,g.w=function(t,e){return v(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function d(t){this.$L=this.$L||D(t.locale,null,!0),this.parse(t)}var $=d.prototype;return $.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(g.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(h);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},$.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},$.$utils=function(){return g},$.isValid=function(){return!("Invalid Date"===this.$d.toString())},$.isSame=function(t,e){var n=v(t);return this.startOf(e)<=n&&n<=this.endOf(e)},$.isAfter=function(t,e){return v(t)<this.startOf(e)},$.isBefore=function(t,e){return this.endOf(e)<v(t)},$.$g=function(t,e,n){return g.u(t)?this[e]:this.set(n,t)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(t,a){var h=this,c=!!g.u(a)||a,d=g.p(t),$=function(t,e){var n=g.w(h.$u?Date.UTC(h.$y,e,t):new Date(h.$y,e,t),h);return c?n:n.endOf(i)},l=function(t,e){return g.w(h.toDate()[t].apply(h.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(e)),h)},y=this.$W,M=this.$M,m=this.$D,D="set"+(this.$u?"UTC":"");switch(d){case o:return c?$(1,0):$(31,11);case u:return c?$(1,M):$(0,M+1);case s:var v=this.$locale().weekStart||0,S=(y<v?y+7:y)-v;return $(c?m-S:m+(6-S),M);case i:case f:return l(D+"Hours",0);case r:return l(D+"Minutes",1);case n:return l(D+"Seconds",2);case e:return l(D+"Milliseconds",3);default:return this.clone()}},$.endOf=function(t){return this.startOf(t,!1)},$.$set=function(s,a){var h,c=g.p(s),d="set"+(this.$u?"UTC":""),$=(h={},h[i]=d+"Date",h[f]=d+"Date",h[u]=d+"Month",h[o]=d+"FullYear",h[r]=d+"Hours",h[n]=d+"Minutes",h[e]=d+"Seconds",h[t]=d+"Milliseconds",h)[c],l=c===i?this.$D+(a-this.$W):a;if(c===u||c===o){var y=this.clone().set(f,1);y.$d[$](l),y.init(),this.$d=y.set(f,Math.min(this.$D,y.daysInMonth())).$d}else $&&this.$d[$](l);return this.init(),this},$.set=function(t,e){return this.clone().$set(t,e)},$.get=function(t){return this[g.p(t)]()},$.add=function(t,a){var f,h=this;t=Number(t);var c=g.p(a),d=function(e){var n=v(h);return g.w(n.date(n.date()+Math.round(e*t)),h)};if(c===u)return this.set(u,this.$M+t);if(c===o)return this.set(o,this.$y+t);if(c===i)return d(1);if(c===s)return d(7);var $=(f={},f[n]=6e4,f[r]=36e5,f[e]=1e3,f)[c]||1,l=this.$d.getTime()+t*$;return g.w(l,this)},$.subtract=function(t,e){return this.add(-1*t,e)},$.format=function(t){var e=this;if(!this.isValid())return"Invalid Date";var n=t||"YYYY-MM-DDTHH:mm:ssZ",r=g.z(this),i=this.$locale(),s=this.$H,u=this.$m,a=this.$M,o=i.weekdays,f=i.months,h=function(t,r,i,s){return t&&(t[r]||t(e,n))||i[r].substr(0,s)},d=function(t){return g.s(s%12||12,t,"0")},$=i.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:g.s(a+1,2,"0"),MMM:h(i.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:g.s(this.$D,2,"0"),d:String(this.$W),dd:h(i.weekdaysMin,this.$W,o,2),ddd:h(i.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:g.s(s,2,"0"),h:d(1),hh:d(2),a:$(s,u,!0),A:$(s,u,!1),m:String(u),mm:g.s(u,2,"0"),s:String(this.$s),ss:g.s(this.$s,2,"0"),SSS:g.s(this.$ms,3,"0"),Z:r};return n.replace(c,function(t,e){return e||l[t]||r.replace(":","")})},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(t,f,h){var c,d=g.p(f),$=v(t),l=6e4*($.utcOffset()-this.utcOffset()),y=this-$,M=g.m(this,$);return M=(c={},c[o]=M/12,c[u]=M,c[a]=M/3,c[s]=(y-l)/6048e5,c[i]=(y-l)/864e5,c[r]=y/36e5,c[n]=y/6e4,c[e]=y/1e3,c)[d]||y,h?M:g.a(M)},$.daysInMonth=function(){return this.endOf(u).$D},$.$locale=function(){return M[this.$L]},$.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=D(t,e,!0);return r&&(n.$L=r),n},$.clone=function(){return g.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},d}(),p=S.prototype;return v.prototype=p,[["$ms",t],["$s",e],["$m",n],["$H",r],["$W",i],["$M",u],["$y",o],["$D",f]].forEach(function(t){p[t[1]]=function(e){return this.$g(e,t[0],t[1])}}),v.extend=function(t,e){return t(e,S,v),v},v.locale=D,v.isDayjs=m,v.unix=function(t){return v(1e3*t)},v.en=M[y],v.Ls=M,v}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.dayjs=e()}(this,function(){"use strict";var t="millisecond",e="second",n="minute",r="hour",i="day",s="week",u="month",a="quarter",o="year",f="date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d+)?$/,c=/\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},$=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},l={s:$,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+$(r,2,"0")+":"+$(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,u),s=n-i<0,a=e.clone().add(r+(s?-1:1),u);return+(-(r+(n-i)/(s?i-a:a-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(h){return{M:u,y:o,w:s,d:i,D:f,h:r,m:n,s:e,ms:t,Q:a}[h]||String(h||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},y="en",M={};M[y]=d;var m=function(t){return t instanceof S},D=function(t,e,n){var r;if(!t)return y;if("string"==typeof t)M[t]&&(r=t),e&&(M[t]=e,r=t);else{var i=t.name;M[i]=t,r=i}return!n&&r&&(y=r),r||!n&&y},v=function(t,e){if(m(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new S(n)},g=l;g.l=D,g.i=m,g.w=function(t,e){return v(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function d(t){this.$L=this.$L||D(t.locale,null,!0),this.parse(t)}var $=d.prototype;return $.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(g.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(h);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},$.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},$.$utils=function(){return g},$.isValid=function(){return!("Invalid Date"===this.$d.toString())},$.isSame=function(t,e){var n=v(t);return this.startOf(e)<=n&&n<=this.endOf(e)},$.isAfter=function(t,e){return v(t)<this.startOf(e)},$.isBefore=function(t,e){return this.endOf(e)<v(t)},$.$g=function(t,e,n){return g.u(t)?this[e]:this.set(n,t)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(t,a){var h=this,c=!!g.u(a)||a,d=g.p(t),$=function(t,e){var n=g.w(h.$u?Date.UTC(h.$y,e,t):new Date(h.$y,e,t),h);return c?n:n.endOf(i)},l=function(t,e){return g.w(h.toDate()[t].apply(h.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(e)),h)},y=this.$W,M=this.$M,m=this.$D,D="set"+(this.$u?"UTC":"");switch(d){case o:return c?$(1,0):$(31,11);case u:return c?$(1,M):$(0,M+1);case s:var v=this.$locale().weekStart||0,S=(y<v?y+7:y)-v;return $(c?m-S:m+(6-S),M);case i:case f:return l(D+"Hours",0);case r:return l(D+"Minutes",1);case n:return l(D+"Seconds",2);case e:return l(D+"Milliseconds",3);default:return this.clone()}},$.endOf=function(t){return this.startOf(t,!1)},$.$set=function(s,a){var h,c=g.p(s),d="set"+(this.$u?"UTC":""),$=(h={},h[i]=d+"Date",h[f]=d+"Date",h[u]=d+"Month",h[o]=d+"FullYear",h[r]=d+"Hours",h[n]=d+"Minutes",h[e]=d+"Seconds",h[t]=d+"Milliseconds",h)[c],l=c===i?this.$D+(a-this.$W):a;if(c===u||c===o){var y=this.clone().set(f,1);y.$d[$](l),y.init(),this.$d=y.set(f,Math.min(this.$D,y.daysInMonth())).$d}else $&&this.$d[$](l);return this.init(),this},$.set=function(t,e){return this.clone().$set(t,e)},$.get=function(t){return this[g.p(t)]()},$.add=function(t,a){var f,h=this;t=Number(t);var c=g.p(a),d=function(e){var n=v(h);return g.w(n.date(n.date()+Math.round(e*t)),h)};if(c===u)return this.set(u,this.$M+t);if(c===o)return this.set(o,this.$y+t);if(c===i)return d(1);if(c===s)return d(7);var $=(f={},f[n]=6e4,f[r]=36e5,f[e]=1e3,f)[c]||1,l=this.$d.getTime()+t*$;return g.w(l,this)},$.subtract=function(t,e){return this.add(-1*t,e)},$.format=function(t){var e=this;if(!this.isValid())return"Invalid Date";var n=t||"YYYY-MM-DDTHH:mm:ssZ",r=g.z(this),i=this.$locale(),s=this.$H,u=this.$m,a=this.$M,o=i.weekdays,f=i.months,h=function(t,r,i,s){return t&&(t[r]||t(e,n))||i[r].substr(0,s)},d=function(t){return g.s(s%12||12,t,"0")},$=i.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:g.s(a+1,2,"0"),MMM:h(i.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:g.s(this.$D,2,"0"),d:String(this.$W),dd:h(i.weekdaysMin,this.$W,o,2),ddd:h(i.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:g.s(s,2,"0"),h:d(1),hh:d(2),a:$(s,u,!0),A:$(s,u,!1),m:String(u),mm:g.s(u,2,"0"),s:String(this.$s),ss:g.s(this.$s,2,"0"),SSS:g.s(this.$ms,3,"0"),Z:r};return n.replace(c,function(t,e){return e||l[t]||r.replace(":","")})},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(t,f,h){var c,d=g.p(f),$=v(t),l=6e4*($.utcOffset()-this.utcOffset()),y=this-$,M=g.m(this,$);return M=(c={},c[o]=M/12,c[u]=M,c[a]=M/3,c[s]=(y-l)/6048e5,c[i]=(y-l)/864e5,c[r]=y/36e5,c[n]=y/6e4,c[e]=y/1e3,c)[d]||y,h?M:g.a(M)},$.daysInMonth=function(){return this.endOf(u).$D},$.$locale=function(){return M[this.$L]},$.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=D(t,e,!0);return r&&(n.$L=r),n},$.clone=function(){return g.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},d}(),p=S.prototype;return v.prototype=p,[["$ms",t],["$s",e],["$m",n],["$H",r],["$W",i],["$M",u],["$y",o],["$D",f]].forEach(function(t){p[t[1]]=function(e){return this.$g(e,t[0],t[1])}}),v.extend=function(t,e){return t(e,S,v),v},v.locale=D,v.isDayjs=m,v.unix=function(t){return v(1e3*t)},v.en=M[y],v.Ls=M,v.p={},v}); |
@@ -24,75 +24,376 @@ /// <reference path="./locale/index.d.ts" /> | ||
constructor (config?: ConfigType) | ||
/** | ||
* All Day.js objects are immutable. Still, `dayjs#clone` can create a clone of the current object if you need one. | ||
* ``` | ||
* dayjs().clone()// => Dayjs | ||
* dayjs(dayjs('2019-01-25')) // passing a Dayjs object to a constructor will also clone it | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/parse/dayjs-clone | ||
*/ | ||
clone(): Dayjs | ||
/** | ||
* This returns a `boolean` indicating whether the Day.js object contains a valid date or not. | ||
* ``` | ||
* dayjs().isValid()// => boolean | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/parse/is-valid | ||
*/ | ||
isValid(): boolean | ||
/** | ||
* Get the year. | ||
* ``` | ||
* dayjs().year()// => 2020 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/year | ||
*/ | ||
year(): number | ||
/** | ||
* Set the year. | ||
* ``` | ||
* dayjs().year(2000)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/year | ||
*/ | ||
year(value: number): Dayjs | ||
/** | ||
* Get the month. | ||
* | ||
* Months are zero indexed, so January is month 0. | ||
* ``` | ||
* dayjs().month()// => 0-11 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/month | ||
*/ | ||
month(): number | ||
/** | ||
* Set the month. | ||
* | ||
* Months are zero indexed, so January is month 0. | ||
* | ||
* Accepts numbers from 0 to 11. If the range is exceeded, it will bubble up to the year. | ||
* ``` | ||
* dayjs().month(0)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/month | ||
*/ | ||
month(value: number): Dayjs | ||
/** | ||
* Get the date of the month. | ||
* ``` | ||
* dayjs().date()// => 1-31 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/date | ||
*/ | ||
date(): number | ||
/** | ||
* Set the date of the month. | ||
* | ||
* Accepts numbers from 1 to 31. If the range is exceeded, it will bubble up to the months. | ||
* ``` | ||
* dayjs().date(1)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/date | ||
*/ | ||
date(value: number): Dayjs | ||
/** | ||
* Get the day of the week. | ||
* | ||
* Returns numbers from 0 (Sunday) to 6 (Saturday). | ||
* ``` | ||
* dayjs().day()// 0-6 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/day | ||
*/ | ||
day(): number | ||
/** | ||
* Set the day of the week. | ||
* | ||
* Accepts numbers from 0 (Sunday) to 6 (Saturday). If the range is exceeded, it will bubble up to other weeks. | ||
* ``` | ||
* dayjs().day(0)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/day | ||
*/ | ||
day(value: number): Dayjs | ||
/** | ||
* Get the hour. | ||
* ``` | ||
* dayjs().hour()// => 0-23 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/hour | ||
*/ | ||
hour(): number | ||
/** | ||
* Set the hour. | ||
* | ||
* Accepts numbers from 0 to 23. If the range is exceeded, it will bubble up to the day. | ||
* ``` | ||
* dayjs().hour(12)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/hour | ||
*/ | ||
hour(value: number): Dayjs | ||
/** | ||
* Get the minutes. | ||
* ``` | ||
* dayjs().minute()// => 0-59 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/minute | ||
*/ | ||
minute(): number | ||
/** | ||
* Set the minutes. | ||
* | ||
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the hour. | ||
* ``` | ||
* dayjs().minute(59)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/minute | ||
*/ | ||
minute(value: number): Dayjs | ||
/** | ||
* Get the seconds. | ||
* ``` | ||
* dayjs().second()// => 0-59 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/second | ||
*/ | ||
second(): number | ||
/** | ||
* Set the seconds. | ||
* | ||
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the minutes. | ||
* ``` | ||
* dayjs().second(1)// Dayjs | ||
* ``` | ||
*/ | ||
second(value: number): Dayjs | ||
/** | ||
* Get the milliseconds. | ||
* ``` | ||
* dayjs().millisecond()// => 0-999 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/millisecond | ||
*/ | ||
millisecond(): number | ||
/** | ||
* Set the milliseconds. | ||
* | ||
* Accepts numbers from 0 to 999. If the range is exceeded, it will bubble up to the seconds. | ||
* ``` | ||
* dayjs().millisecond(1)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/millisecond | ||
*/ | ||
millisecond(value: number): Dayjs | ||
/** | ||
* Generic setter, accepting unit as first argument, and value as second, returns a new instance with the applied changes. | ||
* | ||
* In general: | ||
* ``` | ||
* dayjs().set(unit, value) === dayjs()[unit](value) | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* ``` | ||
* dayjs().set('date', 1) | ||
* dayjs().set('month', 3) // April | ||
* dayjs().set('second', 30) | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/set | ||
*/ | ||
set(unit: UnitType, value: number): Dayjs | ||
/** | ||
* String getter, returns the corresponding information getting from Day.js object. | ||
* | ||
* In general: | ||
* ``` | ||
* dayjs().get(unit) === dayjs()[unit]() | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* ``` | ||
* dayjs().get('year') | ||
* dayjs().get('month') // start 0 | ||
* dayjs().get('date') | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/get | ||
*/ | ||
get(unit: UnitType): number | ||
add(value: number, unit: OpUnitType): Dayjs | ||
subtract(value: number, unit: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object with a specified amount of time added. | ||
* ``` | ||
* dayjs().add(7, 'day')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/add | ||
*/ | ||
add(value: number, unit?: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object with a specified amount of time subtracted. | ||
* ``` | ||
* dayjs().subtract(7, 'year')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/subtract | ||
*/ | ||
subtract(value: number, unit?: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object and set it to the start of a unit of time. | ||
* ``` | ||
* dayjs().startOf('year')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/start-of | ||
*/ | ||
startOf(unit: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object and set it to the end of a unit of time. | ||
* ``` | ||
* dayjs().endOf('month')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/end-of | ||
*/ | ||
endOf(unit: OpUnitType): Dayjs | ||
/** | ||
* Get the formatted date according to the string of tokens passed in. | ||
* | ||
* To escape characters, wrap them in square brackets (e.g. [MM]). | ||
* ``` | ||
* dayjs().format()// => current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00' | ||
* dayjs('2019-01-25').format('[YYYYescape] YYYY-MM-DDTHH:mm:ssZ[Z]')// 'YYYYescape 2019-01-25T00:00:00-02:00Z' | ||
* dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/format | ||
*/ | ||
format(template?: string): string | ||
/** | ||
* This indicates the difference between two date-time in the specified unit. | ||
* | ||
* To get the difference in milliseconds, use `dayjs#diff` | ||
* ``` | ||
* const date1 = dayjs('2019-01-25') | ||
* const date2 = dayjs('2018-06-05') | ||
* date1.diff(date2) // 20214000000 default milliseconds | ||
* ``` | ||
* To get the difference in another unit of measurement, pass that measurement as the second argument. | ||
* ``` | ||
* const date1 = dayjs('2019-01-25') | ||
* date1.diff('2018-06-05', 'month') // 7 | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/difference | ||
*/ | ||
diff(date: ConfigType, unit?: QUnitType | OpUnitType, float?: boolean): number | ||
/** | ||
* This returns the number of **milliseconds** since the Unix Epoch of the Day.js object. | ||
* ``` | ||
* dayjs('2019-01-25').valueOf() // 1548381600000 | ||
* +dayjs(1548381600000) // 1548381600000 | ||
* ``` | ||
* To get a Unix timestamp (the number of seconds since the epoch) from a Day.js object, you should use Unix Timestamp `dayjs#unix()`. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/unix-timestamp-milliseconds | ||
*/ | ||
valueOf(): number | ||
/** | ||
* This returns the Unix timestamp (the number of **seconds** since the Unix Epoch) of the Day.js object. | ||
* ``` | ||
* dayjs('2019-01-25').unix() // 1548381600 | ||
* ``` | ||
* This value is floored to the nearest second, and does not include a milliseconds component. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/unix-timestamp | ||
*/ | ||
unix(): number | ||
/** | ||
* Get the number of days in the current month. | ||
* ``` | ||
* dayjs('2019-01-25').daysInMonth() // 31 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/days-in-month | ||
*/ | ||
daysInMonth(): number | ||
/** | ||
* To get a copy of the native `Date` object parsed from the Day.js object use `dayjs#toDate`. | ||
* ``` | ||
* dayjs('2019-01-25').toDate()// => Date | ||
* ``` | ||
*/ | ||
toDate(): Date | ||
/** | ||
* To serialize as an ISO 8601 string. | ||
* ``` | ||
* dayjs('2019-01-25').toJSON() // '2019-01-25T02:00:00.000Z' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-json | ||
*/ | ||
toJSON(): string | ||
/** | ||
* To format as an ISO 8601 string. | ||
* ``` | ||
* dayjs('2019-01-25').toISOString() // '2019-01-25T02:00:00.000Z' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-iso-string | ||
*/ | ||
toISOString(): string | ||
/** | ||
* Returns a string representation of the date. | ||
* ``` | ||
* dayjs('2019-01-25').toString() // 'Fri, 25 Jan 2019 02:00:00 GMT' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-string | ||
*/ | ||
toString(): string | ||
/** | ||
* Get the UTC offset in minutes. | ||
* ``` | ||
* dayjs().utcOffset() | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/manipulate/utc-offset | ||
*/ | ||
utcOffset(): number | ||
/** | ||
* This indicates whether the Day.js object is before the other supplied date-time. | ||
* ``` | ||
* dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isBefore('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/query/is-before | ||
*/ | ||
isBefore(date: ConfigType, unit?: OpUnitType): boolean | ||
/** | ||
* This indicates whether the Day.js object is the same as the other supplied date-time. | ||
* ``` | ||
* dayjs().isSame(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isSame('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/query/is-same | ||
*/ | ||
isSame(date: ConfigType, unit?: OpUnitType): boolean | ||
/** | ||
* This indicates whether the Day.js object is after the other supplied date-time. | ||
* ``` | ||
* dayjs().isAfter(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isAfter('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/query/is-after | ||
*/ | ||
isAfter(date: ConfigType, unit?: OpUnitType): boolean | ||
@@ -99,0 +400,0 @@ |
@@ -427,2 +427,3 @@ import * as C from './constant'; | ||
dayjs.Ls = Ls; | ||
dayjs.p = {}; | ||
export default dayjs; |
@@ -12,3 +12,5 @@ // English (New Zealand) [en-nz] | ||
ordinal: function ordinal(n) { | ||
return n; | ||
var s = ['th', 'st', 'nd', 'rd']; | ||
var v = n % 100; | ||
return "[" + n + (s[(v - 20) % 10] || s[v] || s[0]) + "]"; | ||
}, | ||
@@ -15,0 +17,0 @@ formats: { |
@@ -17,13 +17,35 @@ // Hungarian [hu] | ||
past: '%s', | ||
s: 'néhány másodperc', | ||
m: 'egy perc', | ||
mm: '%d perc', | ||
h: 'egy óra', | ||
hh: '%d óra', | ||
d: 'egy nap', | ||
dd: '%d nap', | ||
M: 'egy hónap', | ||
MM: '%d hónap', | ||
y: 'egy éve', | ||
yy: '%d év' | ||
s: function s(_, _s, ___, isFuture) { | ||
return "n\xE9h\xE1ny m\xE1sodperc" + (isFuture || _s ? '' : 'e'); | ||
}, | ||
m: function m(_, s, ___, isFuture) { | ||
return "egy perc" + (isFuture || s ? '' : 'e'); | ||
}, | ||
mm: function mm(n, s, ___, isFuture) { | ||
return n + " perc" + (isFuture || s ? '' : 'e'); | ||
}, | ||
h: function h(_, s, ___, isFuture) { | ||
return "egy " + (isFuture || s ? 'óra' : 'órája'); | ||
}, | ||
hh: function hh(n, s, ___, isFuture) { | ||
return n + " " + (isFuture || s ? 'óra' : 'órája'); | ||
}, | ||
d: function d(_, s, ___, isFuture) { | ||
return "egy " + (isFuture || s ? 'nap' : 'napja'); | ||
}, | ||
dd: function dd(n, s, ___, isFuture) { | ||
return n + " " + (isFuture || s ? 'nap' : 'napja'); | ||
}, | ||
M: function M(_, s, ___, isFuture) { | ||
return "egy " + (isFuture || s ? 'hónap' : 'hónapja'); | ||
}, | ||
MM: function MM(n, s, ___, isFuture) { | ||
return n + " " + (isFuture || s ? 'hónap' : 'hónapja'); | ||
}, | ||
y: function y(_, s, ___, isFuture) { | ||
return "egy " + (isFuture || s ? 'év' : 'éve'); | ||
}, | ||
yy: function yy(n, s, ___, isFuture) { | ||
return n + " " + (isFuture || s ? 'év' : 'éve'); | ||
} | ||
}, | ||
@@ -30,0 +52,0 @@ formats: { |
@@ -229,2 +229,3 @@ var formattingTokens = /(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g; | ||
export default (function (o, C, d) { | ||
d.p.customParseFormat = true; | ||
var proto = C.prototype; | ||
@@ -231,0 +232,0 @@ var oldParse = proto.parse; |
@@ -59,4 +59,9 @@ import { PluginFunc } from 'dayjs/esm' | ||
declare module 'dayjs/esm' { | ||
interface Dayjs { | ||
add(value: plugin.Duration): Dayjs | ||
subtract(value: plugin.Duration): Dayjs | ||
} | ||
export function duration(input?: plugin.DurationInputType , unit?: string): plugin.Duration | ||
export function isDuration(d: any): d is plugin.Duration | ||
} |
@@ -263,11 +263,13 @@ import { MILLISECONDS_A_DAY, MILLISECONDS_A_HOUR, MILLISECONDS_A_MINUTE, MILLISECONDS_A_SECOND, MILLISECONDS_A_WEEK } from '../../constant'; | ||
var oldAdd = Dayjs.prototype.add; | ||
var oldSubtract = Dayjs.prototype.subtract; | ||
Dayjs.prototype.add = function (addition, units) { | ||
if (isDuration(addition)) { | ||
addition = addition.asMilliseconds(); | ||
units = 'ms'; | ||
} | ||
Dayjs.prototype.add = function (value, unit) { | ||
if (isDuration(value)) value = value.asMilliseconds(); | ||
return oldAdd.bind(this)(value, unit); | ||
}; | ||
return oldAdd.bind(this)(addition, units); | ||
Dayjs.prototype.subtract = function (value, unit) { | ||
if (isDuration(value)) value = value.asMilliseconds(); | ||
return oldSubtract.bind(this)(value, unit); | ||
}; | ||
}); |
@@ -7,5 +7,35 @@ import { PluginFunc } from 'dayjs/esm' | ||
declare module 'dayjs/esm' { | ||
type WeekdayNames = [string, string, string, string, string, string, string]; | ||
type MonthNames = [string, string, string, string, string, string, string, string, string, string, string, string]; | ||
interface InstanceLocaleDataReturn { | ||
firstDayOfWeek(): number; | ||
weekdays(instance?: Dayjs): WeekdayNames; | ||
weekdaysShort(instance?: Dayjs): WeekdayNames; | ||
weekdaysMin(instance?: Dayjs): WeekdayNames; | ||
months(instance?: Dayjs): MonthNames; | ||
monthsShort(instance?: Dayjs): MonthNames; | ||
longDateFormat(format: string): string; | ||
} | ||
interface GlobalLocaleDataReturn { | ||
firstDayOfWeek(): number; | ||
weekdays(): WeekdayNames; | ||
weekdaysShort(): WeekdayNames; | ||
weekdaysMin(): WeekdayNames; | ||
months(): MonthNames; | ||
monthsShort(): MonthNames; | ||
longDateFormat(format: string): string; | ||
} | ||
interface Dayjs { | ||
localeData(): any | ||
localeData(): InstanceLocaleDataReturn; | ||
} | ||
export function weekdays(localOrder?: boolean): WeekdayNames; | ||
export function weekdaysShort(localOrder?: boolean): WeekdayNames; | ||
export function weekdaysMin(localOrder?: boolean): WeekdayNames; | ||
export function monthsShort(): MonthNames; | ||
export function months(): MonthNames; | ||
export function localeData(): GlobalLocaleDataReturn; | ||
} |
export default (function (o, c, d) { | ||
var sortBy = function sortBy(method, dates) { | ||
if (!dates.length) { | ||
return d(); | ||
if (!dates || !dates.length || !dates[0] || dates.length === 1 && !dates[0].length) { | ||
return null; | ||
} | ||
@@ -6,0 +6,0 @@ |
@@ -8,3 +8,3 @@ import { PluginFunc, ConfigType } from 'dayjs/esm' | ||
interface Dayjs { | ||
tz(timezone?: string): Dayjs | ||
tz(timezone?: string, keepLocalTime?: boolean): Dayjs | ||
} | ||
@@ -14,2 +14,3 @@ | ||
(date: ConfigType, timezone?: string): Dayjs | ||
(date: ConfigType, format: string, timezone?: string): Dayjs | ||
guess(): string | ||
@@ -16,0 +17,0 @@ setDefault(timezone?: string): void |
@@ -0,1 +1,2 @@ | ||
import { MIN, MS } from '../../constant'; | ||
var typeToPos = { | ||
@@ -8,4 +9,3 @@ year: 0, | ||
second: 5 | ||
}; | ||
var ms = 'ms'; // Cache time-zone lookups from Intl.DateTimeFormat, | ||
}; // Cache time-zone lookups from Intl.DateTimeFormat, | ||
// as it is a *very* slow method. | ||
@@ -114,3 +114,3 @@ | ||
proto.tz = function (timezone) { | ||
proto.tz = function (timezone, keepLocalTime) { | ||
if (timezone === void 0) { | ||
@@ -120,2 +120,3 @@ timezone = defaultTimezone; | ||
var oldOffset = this.utcOffset(); | ||
var target = this.toDate().toLocaleString('en-US', { | ||
@@ -125,3 +126,9 @@ timeZone: timezone | ||
var diff = Math.round((this.toDate() - new Date(target)) / 1000 / 60); | ||
var ins = d(target).$set(ms, this.$ms).utcOffset(localUtcOffset - diff, true); | ||
var ins = d(target).$set(MS, this.$ms).utcOffset(localUtcOffset - diff, true); | ||
if (keepLocalTime) { | ||
var newOffset = ins.utcOffset(); | ||
ins = ins.add(oldOffset - newOffset, MIN); | ||
} | ||
ins.$x.$timezone = timezone; | ||
@@ -142,7 +149,5 @@ return ins; | ||
d.tz = function (input, timezone) { | ||
if (timezone === void 0) { | ||
timezone = defaultTimezone; | ||
} | ||
d.tz = function (input, arg1, arg2) { | ||
var parseFormat = arg2 && arg1; | ||
var timezone = arg2 || arg1 || defaultTimezone; | ||
var previousOffset = tzOffset(+d(), timezone); | ||
@@ -156,3 +161,3 @@ var localTs; | ||
localTs = localTs || d.utc(input).valueOf(); | ||
localTs = localTs || d.utc(input, parseFormat).valueOf(); | ||
@@ -159,0 +164,0 @@ var _fixOffset = fixOffset(localTs, previousOffset, timezone), |
379
index.d.ts
@@ -24,75 +24,376 @@ /// <reference path="./locale/index.d.ts" /> | ||
constructor (config?: ConfigType) | ||
/** | ||
* All Day.js objects are immutable. Still, `dayjs#clone` can create a clone of the current object if you need one. | ||
* ``` | ||
* dayjs().clone()// => Dayjs | ||
* dayjs(dayjs('2019-01-25')) // passing a Dayjs object to a constructor will also clone it | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/parse/dayjs-clone | ||
*/ | ||
clone(): Dayjs | ||
/** | ||
* This returns a `boolean` indicating whether the Day.js object contains a valid date or not. | ||
* ``` | ||
* dayjs().isValid()// => boolean | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/parse/is-valid | ||
*/ | ||
isValid(): boolean | ||
/** | ||
* Get the year. | ||
* ``` | ||
* dayjs().year()// => 2020 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/year | ||
*/ | ||
year(): number | ||
/** | ||
* Set the year. | ||
* ``` | ||
* dayjs().year(2000)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/year | ||
*/ | ||
year(value: number): Dayjs | ||
/** | ||
* Get the month. | ||
* | ||
* Months are zero indexed, so January is month 0. | ||
* ``` | ||
* dayjs().month()// => 0-11 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/month | ||
*/ | ||
month(): number | ||
/** | ||
* Set the month. | ||
* | ||
* Months are zero indexed, so January is month 0. | ||
* | ||
* Accepts numbers from 0 to 11. If the range is exceeded, it will bubble up to the year. | ||
* ``` | ||
* dayjs().month(0)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/month | ||
*/ | ||
month(value: number): Dayjs | ||
/** | ||
* Get the date of the month. | ||
* ``` | ||
* dayjs().date()// => 1-31 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/date | ||
*/ | ||
date(): number | ||
/** | ||
* Set the date of the month. | ||
* | ||
* Accepts numbers from 1 to 31. If the range is exceeded, it will bubble up to the months. | ||
* ``` | ||
* dayjs().date(1)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/date | ||
*/ | ||
date(value: number): Dayjs | ||
/** | ||
* Get the day of the week. | ||
* | ||
* Returns numbers from 0 (Sunday) to 6 (Saturday). | ||
* ``` | ||
* dayjs().day()// 0-6 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/day | ||
*/ | ||
day(): number | ||
/** | ||
* Set the day of the week. | ||
* | ||
* Accepts numbers from 0 (Sunday) to 6 (Saturday). If the range is exceeded, it will bubble up to other weeks. | ||
* ``` | ||
* dayjs().day(0)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/day | ||
*/ | ||
day(value: number): Dayjs | ||
/** | ||
* Get the hour. | ||
* ``` | ||
* dayjs().hour()// => 0-23 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/hour | ||
*/ | ||
hour(): number | ||
/** | ||
* Set the hour. | ||
* | ||
* Accepts numbers from 0 to 23. If the range is exceeded, it will bubble up to the day. | ||
* ``` | ||
* dayjs().hour(12)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/hour | ||
*/ | ||
hour(value: number): Dayjs | ||
/** | ||
* Get the minutes. | ||
* ``` | ||
* dayjs().minute()// => 0-59 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/minute | ||
*/ | ||
minute(): number | ||
/** | ||
* Set the minutes. | ||
* | ||
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the hour. | ||
* ``` | ||
* dayjs().minute(59)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/minute | ||
*/ | ||
minute(value: number): Dayjs | ||
/** | ||
* Get the seconds. | ||
* ``` | ||
* dayjs().second()// => 0-59 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/second | ||
*/ | ||
second(): number | ||
/** | ||
* Set the seconds. | ||
* | ||
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the minutes. | ||
* ``` | ||
* dayjs().second(1)// Dayjs | ||
* ``` | ||
*/ | ||
second(value: number): Dayjs | ||
/** | ||
* Get the milliseconds. | ||
* ``` | ||
* dayjs().millisecond()// => 0-999 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/millisecond | ||
*/ | ||
millisecond(): number | ||
/** | ||
* Set the milliseconds. | ||
* | ||
* Accepts numbers from 0 to 999. If the range is exceeded, it will bubble up to the seconds. | ||
* ``` | ||
* dayjs().millisecond(1)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/millisecond | ||
*/ | ||
millisecond(value: number): Dayjs | ||
/** | ||
* Generic setter, accepting unit as first argument, and value as second, returns a new instance with the applied changes. | ||
* | ||
* In general: | ||
* ``` | ||
* dayjs().set(unit, value) === dayjs()[unit](value) | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* ``` | ||
* dayjs().set('date', 1) | ||
* dayjs().set('month', 3) // April | ||
* dayjs().set('second', 30) | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/set | ||
*/ | ||
set(unit: UnitType, value: number): Dayjs | ||
/** | ||
* String getter, returns the corresponding information getting from Day.js object. | ||
* | ||
* In general: | ||
* ``` | ||
* dayjs().get(unit) === dayjs()[unit]() | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* ``` | ||
* dayjs().get('year') | ||
* dayjs().get('month') // start 0 | ||
* dayjs().get('date') | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/get | ||
*/ | ||
get(unit: UnitType): number | ||
add(value: number, unit: OpUnitType): Dayjs | ||
subtract(value: number, unit: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object with a specified amount of time added. | ||
* ``` | ||
* dayjs().add(7, 'day')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/add | ||
*/ | ||
add(value: number, unit?: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object with a specified amount of time subtracted. | ||
* ``` | ||
* dayjs().subtract(7, 'year')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/subtract | ||
*/ | ||
subtract(value: number, unit?: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object and set it to the start of a unit of time. | ||
* ``` | ||
* dayjs().startOf('year')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/start-of | ||
*/ | ||
startOf(unit: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object and set it to the end of a unit of time. | ||
* ``` | ||
* dayjs().endOf('month')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/end-of | ||
*/ | ||
endOf(unit: OpUnitType): Dayjs | ||
/** | ||
* Get the formatted date according to the string of tokens passed in. | ||
* | ||
* To escape characters, wrap them in square brackets (e.g. [MM]). | ||
* ``` | ||
* dayjs().format()// => current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00' | ||
* dayjs('2019-01-25').format('[YYYYescape] YYYY-MM-DDTHH:mm:ssZ[Z]')// 'YYYYescape 2019-01-25T00:00:00-02:00Z' | ||
* dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/format | ||
*/ | ||
format(template?: string): string | ||
/** | ||
* This indicates the difference between two date-time in the specified unit. | ||
* | ||
* To get the difference in milliseconds, use `dayjs#diff` | ||
* ``` | ||
* const date1 = dayjs('2019-01-25') | ||
* const date2 = dayjs('2018-06-05') | ||
* date1.diff(date2) // 20214000000 default milliseconds | ||
* ``` | ||
* To get the difference in another unit of measurement, pass that measurement as the second argument. | ||
* ``` | ||
* const date1 = dayjs('2019-01-25') | ||
* date1.diff('2018-06-05', 'month') // 7 | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/difference | ||
*/ | ||
diff(date: ConfigType, unit?: QUnitType | OpUnitType, float?: boolean): number | ||
/** | ||
* This returns the number of **milliseconds** since the Unix Epoch of the Day.js object. | ||
* ``` | ||
* dayjs('2019-01-25').valueOf() // 1548381600000 | ||
* +dayjs(1548381600000) // 1548381600000 | ||
* ``` | ||
* To get a Unix timestamp (the number of seconds since the epoch) from a Day.js object, you should use Unix Timestamp `dayjs#unix()`. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/unix-timestamp-milliseconds | ||
*/ | ||
valueOf(): number | ||
/** | ||
* This returns the Unix timestamp (the number of **seconds** since the Unix Epoch) of the Day.js object. | ||
* ``` | ||
* dayjs('2019-01-25').unix() // 1548381600 | ||
* ``` | ||
* This value is floored to the nearest second, and does not include a milliseconds component. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/unix-timestamp | ||
*/ | ||
unix(): number | ||
/** | ||
* Get the number of days in the current month. | ||
* ``` | ||
* dayjs('2019-01-25').daysInMonth() // 31 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/days-in-month | ||
*/ | ||
daysInMonth(): number | ||
/** | ||
* To get a copy of the native `Date` object parsed from the Day.js object use `dayjs#toDate`. | ||
* ``` | ||
* dayjs('2019-01-25').toDate()// => Date | ||
* ``` | ||
*/ | ||
toDate(): Date | ||
/** | ||
* To serialize as an ISO 8601 string. | ||
* ``` | ||
* dayjs('2019-01-25').toJSON() // '2019-01-25T02:00:00.000Z' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-json | ||
*/ | ||
toJSON(): string | ||
/** | ||
* To format as an ISO 8601 string. | ||
* ``` | ||
* dayjs('2019-01-25').toISOString() // '2019-01-25T02:00:00.000Z' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-iso-string | ||
*/ | ||
toISOString(): string | ||
/** | ||
* Returns a string representation of the date. | ||
* ``` | ||
* dayjs('2019-01-25').toString() // 'Fri, 25 Jan 2019 02:00:00 GMT' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-string | ||
*/ | ||
toString(): string | ||
/** | ||
* Get the UTC offset in minutes. | ||
* ``` | ||
* dayjs().utcOffset() | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/manipulate/utc-offset | ||
*/ | ||
utcOffset(): number | ||
/** | ||
* This indicates whether the Day.js object is before the other supplied date-time. | ||
* ``` | ||
* dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isBefore('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/query/is-before | ||
*/ | ||
isBefore(date: ConfigType, unit?: OpUnitType): boolean | ||
/** | ||
* This indicates whether the Day.js object is the same as the other supplied date-time. | ||
* ``` | ||
* dayjs().isSame(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isSame('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/query/is-same | ||
*/ | ||
isSame(date: ConfigType, unit?: OpUnitType): boolean | ||
/** | ||
* This indicates whether the Day.js object is after the other supplied date-time. | ||
* ``` | ||
* dayjs().isAfter(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isAfter('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/query/is-after | ||
*/ | ||
isAfter(date: ConfigType, unit?: OpUnitType): boolean | ||
@@ -99,0 +400,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],a):e.dayjs_locale_en_nz=a(e.dayjs)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var a={name:"en-nz",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),weekStart:1,weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ordinal:function(e){return e},formats:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"}};return e.locale(a,null,!0),a}); | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],a):e.dayjs_locale_en_nz=a(e.dayjs)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var a={name:"en-nz",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),weekStart:1,weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ordinal:function(e){var a=["th","st","nd","rd"],_=e%100;return"["+e+(a[(_-20)%10]||a[_]||a[0])+"]"},formats:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"}};return e.locale(a,null,!0),a}); |
@@ -1,1 +0,1 @@ | ||
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],s):e.dayjs_locale_hu=s(e.dayjs)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var s={name:"hu",weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),ordinal:function(e){return e+"."},weekStart:1,relativeTime:{future:"%s múlva",past:"%s",s:"néhány másodperc",m:"egy perc",mm:"%d perc",h:"egy óra",hh:"%d óra",d:"egy nap",dd:"%d nap",M:"egy hónap",MM:"%d hónap",y:"egy éve",yy:"%d év"},formats:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"}};return e.locale(s,null,!0),s}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],n):e.dayjs_locale_hu=n(e.dayjs)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var n={name:"hu",weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),ordinal:function(e){return e+"."},weekStart:1,relativeTime:{future:"%s múlva",past:"%s",s:function(e,n,t,r){return"néhány másodperc"+(r||n?"":"e")},m:function(e,n,t,r){return"egy perc"+(r||n?"":"e")},mm:function(e,n,t,r){return e+" perc"+(r||n?"":"e")},h:function(e,n,t,r){return"egy "+(r||n?"óra":"órája")},hh:function(e,n,t,r){return e+" "+(r||n?"óra":"órája")},d:function(e,n,t,r){return"egy "+(r||n?"nap":"napja")},dd:function(e,n,t,r){return e+" "+(r||n?"nap":"napja")},M:function(e,n,t,r){return"egy "+(r||n?"hónap":"hónapja")},MM:function(e,n,t,r){return e+" "+(r||n?"hónap":"hónapja")},y:function(e,n,t,r){return"egy "+(r||n?"év":"éve")},yy:function(e,n,t,r){return e+" "+(r||n?"év":"éve")}},formats:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"}};return e.locale(n,null,!0),n}); |
{ | ||
"name": "dayjs", | ||
"version": "1.9.3", | ||
"version": "1.9.4", | ||
"description": "2KB immutable date time library alternative to Moment.js with the same modern API ", | ||
@@ -5,0 +5,0 @@ "main": "dayjs.min.js", |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.dayjs_plugin_customParseFormat=e()}(this,function(){"use strict";var t,e=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,o=/\d*[^\s\d-:/()]+/;var i=function(t){return function(e){this[t]=+e}},s=[/[+-]\d\d:?\d\d/,function(t){var e,n;(this.zone||(this.zone={})).offset=(e=t.match(/([+-]|\d\d)/g),0===(n=60*e[1]+ +e[2])?0:"+"===e[0]?-n:n)}],a=function(e){var n=t[e];return n&&(n.indexOf?n:n.s.concat(n.f))},h={A:[/[AP]M/,function(t){this.afternoon="PM"===t}],a:[/[ap]m/,function(t){this.afternoon="pm"===t}],S:[/\d/,function(t){this.milliseconds=100*+t}],SS:[n,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[r,i("seconds")],ss:[r,i("seconds")],m:[r,i("minutes")],mm:[r,i("minutes")],H:[r,i("hours")],h:[r,i("hours")],HH:[r,i("hours")],hh:[r,i("hours")],D:[r,i("day")],DD:[n,i("day")],Do:[o,function(e){var n=t.ordinal,r=e.match(/\d+/);if(this.day=r[0],n)for(var o=1;o<=31;o+=1)n(o).replace(/\[|\]/g,"")===e&&(this.day=o)}],M:[r,i("month")],MM:[n,i("month")],MMM:[o,function(t){var e=a("months"),n=(a("monthsShort")||e.map(function(t){return t.substr(0,3)})).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[o,function(t){var e=a("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e}],Y:[/[+-]?\d+/,i("year")],YY:[n,function(t){t=+t,this.year=t+(t>68?1900:2e3)}],YYYY:[/\d{4}/,i("year")],Z:s,ZZ:s};var f=function(t,n,r){try{var o=function(t){for(var n=t.match(e),r=n.length,o=0;o<r;o+=1){var i=n[o],s=h[i],a=s&&s[0],f=s&&s[1];n[o]=f?{regex:a,parser:f}:i.replace(/^\[|\]$/g,"")}return function(t){for(var e={},o=0,i=0;o<r;o+=1){var s=n[o];if("string"==typeof s)i+=s.length;else{var a=s.regex,h=s.parser,f=t.substr(i),u=a.exec(f)[0];h.call(e,u),t=t.replace(u,"")}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon}}(e),e}}(n)(t),i=o.year,s=o.month,a=o.day,f=o.hours,u=o.minutes,d=o.seconds,c=o.milliseconds,l=o.zone,m=new Date,v=a||(i||s?1:m.getDate()),p=i||m.getFullYear(),y=0;i&&!s||(y=s>0?s-1:m.getMonth());var D=f||0,M=u||0,g=d||0,Y=c||0;return l?new Date(Date.UTC(p,y,v,D,M,g,Y+60*l.offset*1e3)):r?new Date(Date.UTC(p,y,v,D,M,g,Y)):new Date(p,y,v,D,M,g,Y)}catch(t){return new Date("")}};return function(e,n,r){var o=n.prototype,i=o.parse;o.parse=function(e){var n=e.date,o=e.utc,s=e.args;this.$u=o;var a=s[1];if("string"==typeof a){var h=!0===s[2],u=!0===s[3],d=h||u,c=s[2];u&&(c=s[2]),h||(t=c?r.Ls[c]:this.$locale()),this.$d=f(n,a,o),this.init(),c&&!0!==c&&(this.$L=this.locale(c).$L),d&&n!==this.format(a)&&(this.$d=new Date(""))}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var v=r.apply(this,s);if(v.isValid()){this.$d=v.$d,this.$L=v.$L,this.init();break}m===l&&(this.$d=new Date(""))}else i.call(this,e)}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.dayjs_plugin_customParseFormat=e()}(this,function(){"use strict";var t,e=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,o=/\d*[^\s\d-:/()]+/;var s=function(t){return function(e){this[t]=+e}},i=[/[+-]\d\d:?\d\d/,function(t){var e,n;(this.zone||(this.zone={})).offset=(e=t.match(/([+-]|\d\d)/g),0===(n=60*e[1]+ +e[2])?0:"+"===e[0]?-n:n)}],a=function(e){var n=t[e];return n&&(n.indexOf?n:n.s.concat(n.f))},h={A:[/[AP]M/,function(t){this.afternoon="PM"===t}],a:[/[ap]m/,function(t){this.afternoon="pm"===t}],S:[/\d/,function(t){this.milliseconds=100*+t}],SS:[n,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[r,s("seconds")],ss:[r,s("seconds")],m:[r,s("minutes")],mm:[r,s("minutes")],H:[r,s("hours")],h:[r,s("hours")],HH:[r,s("hours")],hh:[r,s("hours")],D:[r,s("day")],DD:[n,s("day")],Do:[o,function(e){var n=t.ordinal,r=e.match(/\d+/);if(this.day=r[0],n)for(var o=1;o<=31;o+=1)n(o).replace(/\[|\]/g,"")===e&&(this.day=o)}],M:[r,s("month")],MM:[n,s("month")],MMM:[o,function(t){var e=a("months"),n=(a("monthsShort")||e.map(function(t){return t.substr(0,3)})).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[o,function(t){var e=a("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e}],Y:[/[+-]?\d+/,s("year")],YY:[n,function(t){t=+t,this.year=t+(t>68?1900:2e3)}],YYYY:[/\d{4}/,s("year")],Z:i,ZZ:i};var f=function(t,n,r){try{var o=function(t){for(var n=t.match(e),r=n.length,o=0;o<r;o+=1){var s=n[o],i=h[s],a=i&&i[0],f=i&&i[1];n[o]=f?{regex:a,parser:f}:s.replace(/^\[|\]$/g,"")}return function(t){for(var e={},o=0,s=0;o<r;o+=1){var i=n[o];if("string"==typeof i)s+=i.length;else{var a=i.regex,h=i.parser,f=t.substr(s),u=a.exec(f)[0];h.call(e,u),t=t.replace(u,"")}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon}}(e),e}}(n)(t),s=o.year,i=o.month,a=o.day,f=o.hours,u=o.minutes,c=o.seconds,d=o.milliseconds,l=o.zone,m=new Date,v=a||(s||i?1:m.getDate()),p=s||m.getFullYear(),y=0;s&&!i||(y=i>0?i-1:m.getMonth());var D=f||0,M=u||0,g=c||0,Y=d||0;return l?new Date(Date.UTC(p,y,v,D,M,g,Y+60*l.offset*1e3)):r?new Date(Date.UTC(p,y,v,D,M,g,Y)):new Date(p,y,v,D,M,g,Y)}catch(t){return new Date("")}};return function(e,n,r){r.p.customParseFormat=!0;var o=n.prototype,s=o.parse;o.parse=function(e){var n=e.date,o=e.utc,i=e.args;this.$u=o;var a=i[1];if("string"==typeof a){var h=!0===i[2],u=!0===i[3],c=h||u,d=i[2];u&&(d=i[2]),h||(t=d?r.Ls[d]:this.$locale()),this.$d=f(n,a,o),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),c&&n!==this.format(a)&&(this.$d=new Date(""))}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){i[1]=a[m-1];var v=r.apply(this,i);if(v.isValid()){this.$d=v.$d,this.$L=v.$L,this.init();break}m===l&&(this.$d=new Date(""))}else s.call(this,e)}}}); |
@@ -59,4 +59,9 @@ import { PluginFunc } from 'dayjs' | ||
declare module 'dayjs' { | ||
interface Dayjs { | ||
add(value: plugin.Duration): Dayjs | ||
subtract(value: plugin.Duration): Dayjs | ||
} | ||
export function duration(input?: plugin.DurationInputType , unit?: string): plugin.Duration | ||
export function isDuration(d: any): d is plugin.Duration | ||
} |
@@ -1,1 +0,1 @@ | ||
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):t.dayjs_plugin_duration=s()}(this,function(){"use strict";var t,s,n=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,i={years:31536e6,months:2592e6,days:864e5,hours:36e5,minutes:6e4,seconds:1e3,milliseconds:1,weeks:6048e5},e=function(t){return t instanceof u},r=function(t,s,n){return new u(t,n,s.$l)},o=function(t){return s.p(t)+"s"},u=function(){function s(t,s,e){var u=this;if(this.$d={},this.$l=e,s)return r(t*i[o(s)],this);if("number"==typeof t)return this.$ms=t,this.parseFromMilliseconds(),this;if("object"==typeof t)return Object.keys(t).forEach(function(s){u.$d[o(s)]=t[s]}),this.calMilliseconds(),this;if("string"==typeof t){var h=t.match(n);if(h)return this.$d.years=h[2],this.$d.months=h[3],this.$d.weeks=h[4],this.$d.days=h[5],this.$d.hours=h[6],this.$d.minutes=h[7],this.$d.seconds=h[8],this.calMilliseconds(),this}return this}var u=s.prototype;return u.calMilliseconds=function(){var t=this;this.$ms=Object.keys(this.$d).reduce(function(s,n){return s+(t.$d[n]||0)*i[n]},0)},u.parseFromMilliseconds=function(){var t=this.$ms;this.$d.years=Math.floor(t/31536e6),t%=31536e6,this.$d.months=Math.floor(t/2592e6),t%=2592e6,this.$d.days=Math.floor(t/864e5),t%=864e5,this.$d.hours=Math.floor(t/36e5),t%=36e5,this.$d.minutes=Math.floor(t/6e4),t%=6e4,this.$d.seconds=Math.floor(t/1e3),t%=1e3,this.$d.milliseconds=t},u.toISOString=function(){var t=this.$d.years?this.$d.years+"Y":"",s=this.$d.months?this.$d.months+"M":"",n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var i=n?n+"D":"",e=this.$d.hours?this.$d.hours+"H":"",r=this.$d.minutes?this.$d.minutes+"M":"",o=this.$d.seconds||0;this.$d.milliseconds&&(o+=this.$d.milliseconds/1e3);var u=o?o+"S":"",h="P"+t+s+i+(e||r||u?"T":"")+e+r+u;return"P"===h?"P0D":h},u.toJSON=function(){return this.toISOString()},u.as=function(t){return this.$ms/i[o(t)]},u.get=function(t){var s=this.$ms,n=o(t);return"milliseconds"===n?s%=1e3:s="weeks"===n?Math.floor(s/i[n]):this.$d[n],s},u.add=function(t,s,n){var u;return u=s?t*i[o(s)]:e(t)?t.$ms:r(t,this).$ms,r(this.$ms+u*(n?-1:1),this)},u.subtract=function(t,s){return this.add(t,s,!0)},u.locale=function(t){var s=this.clone();return s.$l=t,s},u.clone=function(){return r(this.$ms,this)},u.humanize=function(s){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!s)},u.milliseconds=function(){return this.get("milliseconds")},u.asMilliseconds=function(){return this.as("milliseconds")},u.seconds=function(){return this.get("seconds")},u.asSeconds=function(){return this.as("seconds")},u.minutes=function(){return this.get("minutes")},u.asMinutes=function(){return this.as("minutes")},u.hours=function(){return this.get("hours")},u.asHours=function(){return this.as("hours")},u.days=function(){return this.get("days")},u.asDays=function(){return this.as("days")},u.weeks=function(){return this.get("weeks")},u.asWeeks=function(){return this.as("weeks")},u.months=function(){return this.get("months")},u.asMonths=function(){return this.as("months")},u.years=function(){return this.get("years")},u.asYears=function(){return this.as("years")},s}();return function(n,i,o){t=o,s=o().$utils(),o.duration=function(t,s){var n=o.locale();return r(t,{$l:n},s)},o.isDuration=e;var u=i.prototype.add;i.prototype.add=function(t,s){return e(t)&&(t=t.asMilliseconds(),s="ms"),u.bind(this)(t,s)}}}); | ||
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):t.dayjs_plugin_duration=s()}(this,function(){"use strict";var t,s,n=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,i={years:31536e6,months:2592e6,days:864e5,hours:36e5,minutes:6e4,seconds:1e3,milliseconds:1,weeks:6048e5},e=function(t){return t instanceof u},r=function(t,s,n){return new u(t,n,s.$l)},o=function(t){return s.p(t)+"s"},u=function(){function s(t,s,e){var u=this;if(this.$d={},this.$l=e,s)return r(t*i[o(s)],this);if("number"==typeof t)return this.$ms=t,this.parseFromMilliseconds(),this;if("object"==typeof t)return Object.keys(t).forEach(function(s){u.$d[o(s)]=t[s]}),this.calMilliseconds(),this;if("string"==typeof t){var h=t.match(n);if(h)return this.$d.years=h[2],this.$d.months=h[3],this.$d.weeks=h[4],this.$d.days=h[5],this.$d.hours=h[6],this.$d.minutes=h[7],this.$d.seconds=h[8],this.calMilliseconds(),this}return this}var u=s.prototype;return u.calMilliseconds=function(){var t=this;this.$ms=Object.keys(this.$d).reduce(function(s,n){return s+(t.$d[n]||0)*i[n]},0)},u.parseFromMilliseconds=function(){var t=this.$ms;this.$d.years=Math.floor(t/31536e6),t%=31536e6,this.$d.months=Math.floor(t/2592e6),t%=2592e6,this.$d.days=Math.floor(t/864e5),t%=864e5,this.$d.hours=Math.floor(t/36e5),t%=36e5,this.$d.minutes=Math.floor(t/6e4),t%=6e4,this.$d.seconds=Math.floor(t/1e3),t%=1e3,this.$d.milliseconds=t},u.toISOString=function(){var t=this.$d.years?this.$d.years+"Y":"",s=this.$d.months?this.$d.months+"M":"",n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var i=n?n+"D":"",e=this.$d.hours?this.$d.hours+"H":"",r=this.$d.minutes?this.$d.minutes+"M":"",o=this.$d.seconds||0;this.$d.milliseconds&&(o+=this.$d.milliseconds/1e3);var u=o?o+"S":"",h="P"+t+s+i+(e||r||u?"T":"")+e+r+u;return"P"===h?"P0D":h},u.toJSON=function(){return this.toISOString()},u.as=function(t){return this.$ms/i[o(t)]},u.get=function(t){var s=this.$ms,n=o(t);return"milliseconds"===n?s%=1e3:s="weeks"===n?Math.floor(s/i[n]):this.$d[n],s},u.add=function(t,s,n){var u;return u=s?t*i[o(s)]:e(t)?t.$ms:r(t,this).$ms,r(this.$ms+u*(n?-1:1),this)},u.subtract=function(t,s){return this.add(t,s,!0)},u.locale=function(t){var s=this.clone();return s.$l=t,s},u.clone=function(){return r(this.$ms,this)},u.humanize=function(s){return t().add(this.$ms,"ms").locale(this.$l).fromNow(!s)},u.milliseconds=function(){return this.get("milliseconds")},u.asMilliseconds=function(){return this.as("milliseconds")},u.seconds=function(){return this.get("seconds")},u.asSeconds=function(){return this.as("seconds")},u.minutes=function(){return this.get("minutes")},u.asMinutes=function(){return this.as("minutes")},u.hours=function(){return this.get("hours")},u.asHours=function(){return this.as("hours")},u.days=function(){return this.get("days")},u.asDays=function(){return this.as("days")},u.weeks=function(){return this.get("weeks")},u.asWeeks=function(){return this.as("weeks")},u.months=function(){return this.get("months")},u.asMonths=function(){return this.as("months")},u.years=function(){return this.get("years")},u.asYears=function(){return this.as("years")},s}();return function(n,i,o){t=o,s=o().$utils(),o.duration=function(t,s){var n=o.locale();return r(t,{$l:n},s)},o.isDuration=e;var u=i.prototype.add,h=i.prototype.subtract;i.prototype.add=function(t,s){return e(t)&&(t=t.asMilliseconds()),u.bind(this)(t,s)},i.prototype.subtract=function(t,s){return e(t)&&(t=t.asMilliseconds()),h.bind(this)(t,s)}}}); |
@@ -7,5 +7,35 @@ import { PluginFunc } from 'dayjs' | ||
declare module 'dayjs' { | ||
type WeekdayNames = [string, string, string, string, string, string, string]; | ||
type MonthNames = [string, string, string, string, string, string, string, string, string, string, string, string]; | ||
interface InstanceLocaleDataReturn { | ||
firstDayOfWeek(): number; | ||
weekdays(instance?: Dayjs): WeekdayNames; | ||
weekdaysShort(instance?: Dayjs): WeekdayNames; | ||
weekdaysMin(instance?: Dayjs): WeekdayNames; | ||
months(instance?: Dayjs): MonthNames; | ||
monthsShort(instance?: Dayjs): MonthNames; | ||
longDateFormat(format: string): string; | ||
} | ||
interface GlobalLocaleDataReturn { | ||
firstDayOfWeek(): number; | ||
weekdays(): WeekdayNames; | ||
weekdaysShort(): WeekdayNames; | ||
weekdaysMin(): WeekdayNames; | ||
months(): MonthNames; | ||
monthsShort(): MonthNames; | ||
longDateFormat(format: string): string; | ||
} | ||
interface Dayjs { | ||
localeData(): any | ||
localeData(): InstanceLocaleDataReturn; | ||
} | ||
export function weekdays(localOrder?: boolean): WeekdayNames; | ||
export function weekdaysShort(localOrder?: boolean): WeekdayNames; | ||
export function weekdaysMin(localOrder?: boolean): WeekdayNames; | ||
export function monthsShort(): MonthNames; | ||
export function months(): MonthNames; | ||
export function localeData(): GlobalLocaleDataReturn; | ||
} |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.dayjs_plugin_minMax=n()}(this,function(){"use strict";return function(e,n,t){var i=function(e,n){if(!n.length)return t();var i;1===n.length&&n[0].length>0&&(n=n[0]),i=n[0];for(var r=1;r<n.length;r+=1)n[r].isValid()&&!n[r][e](i)||(i=n[r]);return i};t.max=function(){var e=[].slice.call(arguments,0);return i("isAfter",e)},t.min=function(){var e=[].slice.call(arguments,0);return i("isBefore",e)}}}); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):n.dayjs_plugin_minMax=e()}(this,function(){"use strict";return function(n,e,t){var i=function(n,e){if(!e||!e.length||!e[0]||1===e.length&&!e[0].length)return null;var t;1===e.length&&e[0].length>0&&(e=e[0]),t=e[0];for(var i=1;i<e.length;i+=1)e[i].isValid()&&!e[i][n](t)||(t=e[i]);return t};t.max=function(){var n=[].slice.call(arguments,0);return i("isAfter",n)},t.min=function(){var n=[].slice.call(arguments,0);return i("isBefore",n)}}}); |
@@ -8,3 +8,3 @@ import { PluginFunc, ConfigType } from 'dayjs' | ||
interface Dayjs { | ||
tz(timezone?: string): Dayjs | ||
tz(timezone?: string, keepLocalTime?: boolean): Dayjs | ||
} | ||
@@ -14,2 +14,3 @@ | ||
(date: ConfigType, timezone?: string): Dayjs | ||
(date: ConfigType, format: string, timezone?: string): Dayjs | ||
guess(): string | ||
@@ -16,0 +17,0 @@ setDefault(timezone?: string): void |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.dayjs_plugin_timezone=t()}(this,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(n,o,i){var r,u=i().utcOffset(),a=function(e,n,o){void 0===o&&(o={});var i=new Date(e);return function(e,n){void 0===n&&(n={});var o=n.timeZoneName||"short",i=e+"|"+o,r=t[i];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:o}),t[i]=r),r}(n,o).formatToParts(i)},f=function(t,n){for(var o=a(t,n),r=[],u=0;u<o.length;u+=1){var f=o[u],m=f.type,s=f.value,c=e[m];c>=0&&(r[c]=parseInt(s,10))}var d=r[3],v=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+v+":"+r[4]+":"+r[5]+":000",l=+t;return(i.utc(h).valueOf()-(l-=l%1e3))/6e4},m=o.prototype;m.tz=function(e){void 0===e&&(e=r);var t=this.toDate().toLocaleString("en-US",{timeZone:e}),n=Math.round((this.toDate()-new Date(t))/1e3/60),o=i(t).$set("ms",this.$ms).utcOffset(u-n,!0);return o.$x.$timezone=e,o},m.offsetName=function(e){var t=this.$x.$timezone||i.tz.guess(),n=a(this.valueOf(),t,{timeZoneName:e}).find(function(e){return"timezonename"===e.type.toLowerCase()});return n&&n.value},i.tz=function(e,t){void 0===t&&(t=r);var n,o=f(+i(),t);"string"!=typeof e&&(n=i(e)+60*o*1e3);var u=function(e,t,n){var o=e-60*t*1e3,i=f(o,n);if(t===i)return[o,t];var r=f(o-=60*(i-t)*1e3,n);return i===r?[o,i]:[e-60*Math.min(i,r)*1e3,Math.max(i,r)]}(n=n||i.utc(e).valueOf(),o,t),a=u[0],m=u[1],s=i(a).utcOffset(m);return s.$x.$timezone=t,s},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(e){r=e}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.dayjs_plugin_timezone=e()}(this,function(){"use strict";var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,u=o().utcOffset(),a=function(t,n,i){void 0===i&&(i={});var o=new Date(t);return function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r}(n,i).formatToParts(o)},f=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10))}var d=r[3],v=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+v+":"+r[4]+":"+r[5]+":000",l=+e;return(o.utc(h).valueOf()-(l-=l%1e3))/6e4},s=i.prototype;s.tz=function(t,e){void 0===t&&(t=r);var n=this.utcOffset(),i=this.toDate().toLocaleString("en-US",{timeZone:t}),a=Math.round((this.toDate()-new Date(i))/1e3/60),f=o(i).$set("millisecond",this.$ms).utcOffset(u-a,!0);if(e){var s=f.utcOffset();f=f.add(n-s,"minute")}return f.$x.$timezone=t,f},s.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find(function(t){return"timezonename"===t.type.toLowerCase()});return n&&n.value},o.tz=function(t,e,n){var i,u=n&&e,a=n||e||r,s=f(+o(),a);"string"!=typeof t&&(i=o(t)+60*s*1e3);var m=function(t,e,n){var i=t-60*e*1e3,o=f(i,n);if(e===o)return[i,e];var r=f(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)]}(i=i||o.utc(t,u).valueOf(),s,a),c=m[0],d=m[1],v=o(c).utcOffset(d);return v.$x.$timezone=a,v},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(t){r=t}}}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
562587
429
9873