@acrool/js-utils
Advanced tools
+19
-3
@@ -1,3 +0,2 @@ | ||
| import dayjs from 'dayjs'; | ||
| import { TDayList } from './types'; | ||
| import dayjs, { Dayjs } from 'dayjs'; | ||
| export declare const dateUtils: { | ||
@@ -11,2 +10,10 @@ today: dayjs.Dayjs; | ||
| }; | ||
| export declare const format: { | ||
| date: string; | ||
| dateDash: string; | ||
| dateTime: string; | ||
| shortDateTime: string; | ||
| shortTime: string; | ||
| time: string; | ||
| }; | ||
| export declare enum EDayKey { | ||
@@ -18,4 +25,13 @@ today = "today", | ||
| twoWeekAgo = "twoWeekAgo", | ||
| thisMonth = "thisMonth" | ||
| thisMonth = "thisMonth", | ||
| lastMonth = "lastMonth", | ||
| twoMonth = "twoMonth", | ||
| thisHalfYear = "thisHalfYear", | ||
| thisYear = "thisYear" | ||
| } | ||
| export interface IRangeDate { | ||
| startDate: Dayjs; | ||
| endDate: Dayjs; | ||
| } | ||
| export type TDayList = Record<EDayKey, IRangeDate>; | ||
| export declare const dayList: TDayList; |
@@ -1,1 +0,1 @@ | ||
| "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ct=require("../common-Dr5ahruw.cjs");function ft(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var J={exports:{}},dt=J.exports,tt;function ht(){return tt||(tt=1,function(s,d){(function($,M){s.exports=M()})(dt,function(){var $=1e3,M=6e4,w=36e5,v="millisecond",D="second",b="minute",O="hour",g="day",F="week",S="month",G="quarter",k="year",H="date",X="Invalid Date",it=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,at=/\[([^\]]+)]|Y{1,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,ot={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("_"),ordinal:function(i){var n=["th","st","nd","rd"],t=i%100;return"["+i+(n[(t-20)%10]||n[t]||n[0])+"]"}},z=function(i,n,t){var r=String(i);return!r||r.length>=n?i:""+Array(n+1-r.length).join(t)+i},ut={s:z,z:function(i){var n=-i.utcOffset(),t=Math.abs(n),r=Math.floor(t/60),e=t%60;return(n<=0?"+":"-")+z(r,2,"0")+":"+z(e,2,"0")},m:function i(n,t){if(n.date()<t.date())return-i(t,n);var r=12*(t.year()-n.year())+(t.month()-n.month()),e=n.clone().add(r,S),a=t-e<0,o=n.clone().add(r+(a?-1:1),S);return+(-(r+(t-e)/(a?e-o:o-e))||0)},a:function(i){return i<0?Math.ceil(i)||0:Math.floor(i)},p:function(i){return{M:S,y:k,w:F,d:g,D:H,h:O,m:b,s:D,ms:v,Q:G}[i]||String(i||"").toLowerCase().replace(/s$/,"")},u:function(i){return i===void 0}},L="en",Y={};Y[L]=ot;var E="$isDayjsObject",P=function(i){return i instanceof V||!(!i||!i[E])},N=function i(n,t,r){var e;if(!n)return L;if(typeof n=="string"){var a=n.toLowerCase();Y[a]&&(e=a),t&&(Y[a]=t,e=a);var o=n.split("-");if(!e&&o.length>1)return i(o[0])}else{var c=n.name;Y[c]=n,e=c}return!r&&e&&(L=e),e||!r&&L},h=function(i,n){if(P(i))return i.clone();var t=typeof n=="object"?n:{};return t.date=i,t.args=arguments,new V(t)},u=ut;u.l=N,u.i=P,u.w=function(i,n){return h(i,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var V=function(){function i(t){this.$L=N(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[E]=!0}var n=i.prototype;return n.parse=function(t){this.$d=function(r){var e=r.date,a=r.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var o=e.match(it);if(o){var c=o[2]-1||0,f=(o[7]||"0").substring(0,3);return a?new Date(Date.UTC(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,f)):new Date(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,f)}}return new Date(e)}(t),this.init()},n.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()},n.$utils=function(){return u},n.isValid=function(){return this.$d.toString()!==X},n.isSame=function(t,r){var e=h(t);return this.startOf(r)<=e&&e<=this.endOf(r)},n.isAfter=function(t,r){return h(t)<this.startOf(r)},n.isBefore=function(t,r){return this.endOf(r)<h(t)},n.$g=function(t,r,e){return u.u(t)?this[r]:this.set(e,t)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(t,r){var e=this,a=!!u.u(r)||r,o=u.p(t),c=function(W,y){var T=u.w(e.$u?Date.UTC(e.$y,y,W):new Date(e.$y,y,W),e);return a?T:T.endOf(g)},f=function(W,y){return u.w(e.toDate()[W].apply(e.toDate("s"),(a?[0,0,0,0]:[23,59,59,999]).slice(y)),e)},l=this.$W,m=this.$M,p=this.$D,A="set"+(this.$u?"UTC":"");switch(o){case k:return a?c(1,0):c(31,11);case S:return a?c(1,m):c(0,m+1);case F:var j=this.$locale().weekStart||0,C=(l<j?l+7:l)-j;return c(a?p-C:p+(6-C),m);case g:case H:return f(A+"Hours",0);case O:return f(A+"Minutes",1);case b:return f(A+"Seconds",2);case D:return f(A+"Milliseconds",3);default:return this.clone()}},n.endOf=function(t){return this.startOf(t,!1)},n.$set=function(t,r){var e,a=u.p(t),o="set"+(this.$u?"UTC":""),c=(e={},e[g]=o+"Date",e[H]=o+"Date",e[S]=o+"Month",e[k]=o+"FullYear",e[O]=o+"Hours",e[b]=o+"Minutes",e[D]=o+"Seconds",e[v]=o+"Milliseconds",e)[a],f=a===g?this.$D+(r-this.$W):r;if(a===S||a===k){var l=this.clone().set(H,1);l.$d[c](f),l.init(),this.$d=l.set(H,Math.min(this.$D,l.daysInMonth())).$d}else c&&this.$d[c](f);return this.init(),this},n.set=function(t,r){return this.clone().$set(t,r)},n.get=function(t){return this[u.p(t)]()},n.add=function(t,r){var e,a=this;t=Number(t);var o=u.p(r),c=function(m){var p=h(a);return u.w(p.date(p.date()+Math.round(m*t)),a)};if(o===S)return this.set(S,this.$M+t);if(o===k)return this.set(k,this.$y+t);if(o===g)return c(1);if(o===F)return c(7);var f=(e={},e[b]=M,e[O]=w,e[D]=$,e)[o]||1,l=this.$d.getTime()+t*f;return u.w(l,this)},n.subtract=function(t,r){return this.add(-1*t,r)},n.format=function(t){var r=this,e=this.$locale();if(!this.isValid())return e.invalidDate||X;var a=t||"YYYY-MM-DDTHH:mm:ssZ",o=u.z(this),c=this.$H,f=this.$m,l=this.$M,m=e.weekdays,p=e.months,A=e.meridiem,j=function(y,T,I,q){return y&&(y[T]||y(r,a))||I[T].slice(0,q)},C=function(y){return u.s(c%12||12,y,"0")},W=A||function(y,T,I){var q=y<12?"AM":"PM";return I?q.toLowerCase():q};return a.replace(at,function(y,T){return T||function(I){switch(I){case"YY":return String(r.$y).slice(-2);case"YYYY":return u.s(r.$y,4,"0");case"M":return l+1;case"MM":return u.s(l+1,2,"0");case"MMM":return j(e.monthsShort,l,p,3);case"MMMM":return j(p,l);case"D":return r.$D;case"DD":return u.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return j(e.weekdaysMin,r.$W,m,2);case"ddd":return j(e.weekdaysShort,r.$W,m,3);case"dddd":return m[r.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return C(1);case"hh":return C(2);case"a":return W(c,f,!0);case"A":return W(c,f,!1);case"m":return String(f);case"mm":return u.s(f,2,"0");case"s":return String(r.$s);case"ss":return u.s(r.$s,2,"0");case"SSS":return u.s(r.$ms,3,"0");case"Z":return o}return null}(y)||o.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,r,e){var a,o=this,c=u.p(r),f=h(t),l=(f.utcOffset()-this.utcOffset())*M,m=this-f,p=function(){return u.m(o,f)};switch(c){case k:a=p()/12;break;case S:a=p();break;case G:a=p()/3;break;case F:a=(m-l)/6048e5;break;case g:a=(m-l)/864e5;break;case O:a=m/w;break;case b:a=m/M;break;case D:a=m/$;break;default:a=m}return e?a:u.a(a)},n.daysInMonth=function(){return this.endOf(S).$D},n.$locale=function(){return Y[this.$L]},n.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),a=N(t,r,!0);return a&&(e.$L=a),e},n.clone=function(){return u.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},i}(),K=V.prototype;return h.prototype=K,[["$ms",v],["$s",D],["$m",b],["$H",O],["$W",g],["$M",S],["$y",k],["$D",H]].forEach(function(i){K[i[1]]=function(n){return this.$g(n,i[0],i[1])}}),h.extend=function(i,n){return i.$i||(i(n,V,h),i.$i=!0),h},h.locale=N,h.isDayjs=P,h.unix=function(i){return h(1e3*i)},h.en=Y[L],h.Ls=Y,h.p={},h})}(J)),J.exports}var lt=ht();const x=ft(lt);function $t(s){if(!s||!s.trim())return"";const d=x(s);if(!d.isValid())return"";const $=Z(s),M=d.format("HH:mm");return`${$} ${M}`}function Z(s){if(!s||!s.trim())return"";const d=x(s);return d.isValid()?x().isSame(d,"year")?d.format("MM/DD"):d.format("YYYY/MM/DD"):""}function mt(s,d){const $=[s,d].filter(D=>D!==""&&D&&D!=="0000-00-00");if($.length===1||$[0]===$[1])return Z($[0]);const M=x(s),w=x(d),v={shortDate:"MM/DD",fullDate:"YYYY/MM/DD"};return M.isSame(d,"year")?[Z(s),w.format(v.shortDate)].join(" - "):[M.format(v.fullDate),w.format(v.fullDate)].join(" - ")}const et=(s,d=!1)=>{const $=d?Math.floor(s/60/60/24):0,M=Math.floor(d?s/60/60%24:s/3600),w=Math.floor(s%3600/60),v=s%60;return{days:$,hours:M,minutes:w,seconds:v}},Mt=(s,d=!1)=>{const{hours:$,minutes:M,seconds:w}=et(s,!1),v=[$,M,w];let D=0;return v.reduce((b,O,g)=>D>=g&&d&&O===0?(D=g,b):[...b,ct.paddingLeft(O,2)],[]).join(":")},yt=(s,d=!1)=>{const $=s/1e3;return d?Math.floor($):$},nt=s=>s*60*1e3,rt=s=>nt(s*60),Dt=s=>rt(s*24),_=x(),U=_.day(0),B=U.subtract(7,"day"),Q=U.subtract(14,"day"),R=_.set("date",1),pt=_.subtract(6,"month"),vt={today:_,thisWeek:U,lastWeek:B,twoWeekAgo:Q,thisMonth:R,halfYearAgo:pt};var st=(s=>(s.today="today",s.yesterday="yesterday",s.thisWeek="thisWeek",s.lastWeek="lastWeek",s.twoWeekAgo="twoWeekAgo",s.thisMonth="thisMonth",s))(st||{});const gt={today:{startDate:_,endDate:_},yesterday:{startDate:_.subtract(1,"day"),endDate:_.subtract(1,"day")},thisWeek:{startDate:U,endDate:U.add(6,"day")},lastWeek:{startDate:B,endDate:B.add(6,"day")},twoWeekAgo:{startDate:Q,endDate:Q.add(6,"day")},thisMonth:{startDate:R,endDate:R.endOf("month")}};exports.EDayKey=st;exports.dateUtils=vt;exports.dayList=gt;exports.dayToMillisecond=Dt;exports.formatSecondToString=Mt;exports.formatTotalSeconds=et;exports.hourToMillisecond=rt;exports.millisecondToSeconds=yt;exports.minuteToMillisecond=nt;exports.rangeSimpleDate=mt;exports.simpleDate=Z;exports.simpleDateTime=$t; | ||
| "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const dt=require("../common-Dr5ahruw.cjs");function lt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Z={exports:{}},mt=Z.exports,tt;function $t(){return tt||(tt=1,function(s,h){(function(m,M){s.exports=M()})(mt,function(){var m=1e3,M=6e4,S=36e5,v="millisecond",y="second",b="minute",O="hour",g="day",N="week",Y="month",G="quarter",T="year",W="date",X="Invalid Date",ut=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,ct=/\[([^\]]+)]|Y{1,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,ft={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("_"),ordinal:function(a){var n=["th","st","nd","rd"],t=a%100;return"["+a+(n[(t-20)%10]||n[t]||n[0])+"]"}},P=function(a,n,t){var r=String(a);return!r||r.length>=n?a:""+Array(n+1-r.length).join(t)+a},ht={s:P,z:function(a){var n=-a.utcOffset(),t=Math.abs(n),r=Math.floor(t/60),e=t%60;return(n<=0?"+":"-")+P(r,2,"0")+":"+P(e,2,"0")},m:function a(n,t){if(n.date()<t.date())return-a(t,n);var r=12*(t.year()-n.year())+(t.month()-n.month()),e=n.clone().add(r,Y),i=t-e<0,o=n.clone().add(r+(i?-1:1),Y);return+(-(r+(t-e)/(i?e-o:o-e))||0)},a:function(a){return a<0?Math.ceil(a)||0:Math.floor(a)},p:function(a){return{M:Y,y:T,w:N,d:g,D:W,h:O,m:b,s:y,ms:v,Q:G}[a]||String(a||"").toLowerCase().replace(/s$/,"")},u:function(a){return a===void 0}},L="en",_={};_[L]=ft;var E="$isDayjsObject",B=function(a){return a instanceof q||!(!a||!a[E])},V=function a(n,t,r){var e;if(!n)return L;if(typeof n=="string"){var i=n.toLowerCase();_[i]&&(e=i),t&&(_[i]=t,e=i);var o=n.split("-");if(!e&&o.length>1)return a(o[0])}else{var c=n.name;_[c]=n,e=c}return!r&&e&&(L=e),e||!r&&L},d=function(a,n){if(B(a))return a.clone();var t=typeof n=="object"?n:{};return t.date=a,t.args=arguments,new q(t)},u=ht;u.l=V,u.i=B,u.w=function(a,n){return d(a,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var q=function(){function a(t){this.$L=V(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[E]=!0}var n=a.prototype;return n.parse=function(t){this.$d=function(r){var e=r.date,i=r.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var o=e.match(ut);if(o){var c=o[2]-1||0,f=(o[7]||"0").substring(0,3);return i?new Date(Date.UTC(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,f)):new Date(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,f)}}return new Date(e)}(t),this.init()},n.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()},n.$utils=function(){return u},n.isValid=function(){return this.$d.toString()!==X},n.isSame=function(t,r){var e=d(t);return this.startOf(r)<=e&&e<=this.endOf(r)},n.isAfter=function(t,r){return d(t)<this.startOf(r)},n.isBefore=function(t,r){return this.endOf(r)<d(t)},n.$g=function(t,r,e){return u.u(t)?this[r]:this.set(e,t)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(t,r){var e=this,i=!!u.u(r)||r,o=u.p(t),c=function(j,D){var k=u.w(e.$u?Date.UTC(e.$y,D,j):new Date(e.$y,D,j),e);return i?k:k.endOf(g)},f=function(j,D){return u.w(e.toDate()[j].apply(e.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(D)),e)},l=this.$W,$=this.$M,p=this.$D,A="set"+(this.$u?"UTC":"");switch(o){case T:return i?c(1,0):c(31,11);case Y:return i?c(1,$):c(0,$+1);case N:var H=this.$locale().weekStart||0,C=(l<H?l+7:l)-H;return c(i?p-C:p+(6-C),$);case g:case W:return f(A+"Hours",0);case O:return f(A+"Minutes",1);case b:return f(A+"Seconds",2);case y:return f(A+"Milliseconds",3);default:return this.clone()}},n.endOf=function(t){return this.startOf(t,!1)},n.$set=function(t,r){var e,i=u.p(t),o="set"+(this.$u?"UTC":""),c=(e={},e[g]=o+"Date",e[W]=o+"Date",e[Y]=o+"Month",e[T]=o+"FullYear",e[O]=o+"Hours",e[b]=o+"Minutes",e[y]=o+"Seconds",e[v]=o+"Milliseconds",e)[i],f=i===g?this.$D+(r-this.$W):r;if(i===Y||i===T){var l=this.clone().set(W,1);l.$d[c](f),l.init(),this.$d=l.set(W,Math.min(this.$D,l.daysInMonth())).$d}else c&&this.$d[c](f);return this.init(),this},n.set=function(t,r){return this.clone().$set(t,r)},n.get=function(t){return this[u.p(t)]()},n.add=function(t,r){var e,i=this;t=Number(t);var o=u.p(r),c=function($){var p=d(i);return u.w(p.date(p.date()+Math.round($*t)),i)};if(o===Y)return this.set(Y,this.$M+t);if(o===T)return this.set(T,this.$y+t);if(o===g)return c(1);if(o===N)return c(7);var f=(e={},e[b]=M,e[O]=S,e[y]=m,e)[o]||1,l=this.$d.getTime()+t*f;return u.w(l,this)},n.subtract=function(t,r){return this.add(-1*t,r)},n.format=function(t){var r=this,e=this.$locale();if(!this.isValid())return e.invalidDate||X;var i=t||"YYYY-MM-DDTHH:mm:ssZ",o=u.z(this),c=this.$H,f=this.$m,l=this.$M,$=e.weekdays,p=e.months,A=e.meridiem,H=function(D,k,I,J){return D&&(D[k]||D(r,i))||I[k].slice(0,J)},C=function(D){return u.s(c%12||12,D,"0")},j=A||function(D,k,I){var J=D<12?"AM":"PM";return I?J.toLowerCase():J};return i.replace(ct,function(D,k){return k||function(I){switch(I){case"YY":return String(r.$y).slice(-2);case"YYYY":return u.s(r.$y,4,"0");case"M":return l+1;case"MM":return u.s(l+1,2,"0");case"MMM":return H(e.monthsShort,l,p,3);case"MMMM":return H(p,l);case"D":return r.$D;case"DD":return u.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return H(e.weekdaysMin,r.$W,$,2);case"ddd":return H(e.weekdaysShort,r.$W,$,3);case"dddd":return $[r.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return C(1);case"hh":return C(2);case"a":return j(c,f,!0);case"A":return j(c,f,!1);case"m":return String(f);case"mm":return u.s(f,2,"0");case"s":return String(r.$s);case"ss":return u.s(r.$s,2,"0");case"SSS":return u.s(r.$ms,3,"0");case"Z":return o}return null}(D)||o.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,r,e){var i,o=this,c=u.p(r),f=d(t),l=(f.utcOffset()-this.utcOffset())*M,$=this-f,p=function(){return u.m(o,f)};switch(c){case T:i=p()/12;break;case Y:i=p();break;case G:i=p()/3;break;case N:i=($-l)/6048e5;break;case g:i=($-l)/864e5;break;case O:i=$/S;break;case b:i=$/M;break;case y:i=$/m;break;default:i=$}return e?i:u.a(i)},n.daysInMonth=function(){return this.endOf(Y).$D},n.$locale=function(){return _[this.$L]},n.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),i=V(t,r,!0);return i&&(e.$L=i),e},n.clone=function(){return u.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},a}(),K=q.prototype;return d.prototype=K,[["$ms",v],["$s",y],["$m",b],["$H",O],["$W",g],["$M",Y],["$y",T],["$D",W]].forEach(function(a){K[a[1]]=function(n){return this.$g(n,a[0],a[1])}}),d.extend=function(a,n){return a.$i||(a(n,q,d),a.$i=!0),d},d.locale=V,d.isDayjs=B,d.unix=function(a){return d(1e3*a)},d.en=_[L],d.Ls=_,d.p={},d})}(Z)),Z.exports}var Mt=$t();const x=lt(Mt);function Dt(s){if(!s||!s.trim())return"";const h=x(s);if(!h.isValid())return"";const m=z(s),M=h.format("HH:mm");return`${m} ${M}`}function z(s){if(!s||!s.trim())return"";const h=x(s);return h.isValid()?x().isSame(h,"year")?h.format("MM/DD"):h.format("YYYY/MM/DD"):""}function yt(s,h){const m=[s,h].filter(y=>y!==""&&y&&y!=="0000-00-00");if(m.length===1||m[0]===m[1])return z(m[0]);const M=x(s),S=x(h),v={shortDate:"MM/DD",fullDate:"YYYY/MM/DD"};return M.isSame(h,"year")?[z(s),S.format(v.shortDate)].join(" - "):[M.format(v.fullDate),S.format(v.fullDate)].join(" - ")}const st=(s,h=!1)=>{const m=h?Math.floor(s/60/60/24):0,M=Math.floor(h?s/60/60%24:s/3600),S=Math.floor(s%3600/60),v=s%60;return{days:m,hours:M,minutes:S,seconds:v}},pt=(s,h=!1)=>{const{hours:m,minutes:M,seconds:S}=st(s,!1),v=[m,M,S];let y=0;return v.reduce((b,O,g)=>y>=g&&h&&O===0?(y=g,b):[...b,dt.paddingLeft(O,2)],[]).join(":")},vt=(s,h=!1)=>{const m=s/1e3;return h?Math.floor(m):m},at=s=>s*60*1e3,it=s=>at(s*60),gt=s=>it(s*24),w=x(),U=w.day(0),Q=U.subtract(7,"day"),R=U.subtract(14,"day"),F=w.set("date",1),et=F.subtract(1,"month"),nt=F.subtract(2,"month"),rt=w.set("month",0).set("date",1),Yt=w.subtract(6,"month"),wt={today:w,thisWeek:U,lastWeek:Q,twoWeekAgo:R,thisMonth:F,halfYearAgo:Yt},St={date:"YYYY/MM/DD",dateDash:"YYYY-MM-DD",dateTime:"YYYY/MM/DD HH:mm:ss",shortDateTime:"YYYY/MM/DD HH:mm",shortTime:"HH:mm",time:"HH:mm:ss"};var ot=(s=>(s.today="today",s.yesterday="yesterday",s.thisWeek="thisWeek",s.lastWeek="lastWeek",s.twoWeekAgo="twoWeekAgo",s.thisMonth="thisMonth",s.lastMonth="lastMonth",s.twoMonth="twoMonth",s.thisHalfYear="thisHalfYear",s.thisYear="thisYear",s))(ot||{});const bt={today:{startDate:w,endDate:w},yesterday:{startDate:w.subtract(1,"day"),endDate:w.subtract(1,"day")},thisWeek:{startDate:U,endDate:U.add(6,"day")},lastWeek:{startDate:Q,endDate:Q.add(6,"day")},twoWeekAgo:{startDate:R,endDate:R.add(6,"day")},thisMonth:{startDate:F,endDate:F.endOf("month")},lastMonth:{startDate:et,endDate:et.endOf("month")},twoMonth:{startDate:nt,endDate:nt.endOf("month")},thisHalfYear:{startDate:w.subtract(6,"month"),endDate:w},thisYear:{startDate:rt,endDate:rt.endOf("year")}};exports.EDayKey=ot;exports.dateUtils=wt;exports.dayList=bt;exports.dayToMillisecond=gt;exports.format=St;exports.formatSecondToString=pt;exports.formatTotalSeconds=st;exports.hourToMillisecond=it;exports.millisecondToSeconds=vt;exports.minuteToMillisecond=at;exports.rangeSimpleDate=yt;exports.simpleDate=z;exports.simpleDateTime=Dt; |
+202
-190
@@ -1,71 +0,71 @@ | ||
| import { p as it } from "../common-2EJV7dbr.js"; | ||
| function at(s) { | ||
| import { p as ut } from "../common-2EJV7dbr.js"; | ||
| function ct(s) { | ||
| return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; | ||
| } | ||
| var Z = { exports: {} }, ut = Z.exports, tt; | ||
| function ot() { | ||
| var q = { exports: {} }, ft = q.exports, tt; | ||
| function ht() { | ||
| return tt || (tt = 1, function(s, h) { | ||
| (function($, M) { | ||
| (function(m, M) { | ||
| s.exports = M(); | ||
| })(ut, function() { | ||
| var $ = 1e3, M = 6e4, S = 36e5, v = "millisecond", D = "second", O = "minute", b = "hour", g = "day", F = "week", w = "month", G = "quarter", k = "year", H = "date", X = "Invalid Date", et = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, nt = /\[([^\]]+)]|Y{1,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, rt = { 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("_"), ordinal: function(i) { | ||
| var n = ["th", "st", "nd", "rd"], t = i % 100; | ||
| return "[" + i + (n[(t - 20) % 10] || n[t] || n[0]) + "]"; | ||
| } }, q = function(i, n, t) { | ||
| var r = String(i); | ||
| return !r || r.length >= n ? i : "" + Array(n + 1 - r.length).join(t) + i; | ||
| }, st = { s: q, z: function(i) { | ||
| var n = -i.utcOffset(), t = Math.abs(n), r = Math.floor(t / 60), e = t % 60; | ||
| return (n <= 0 ? "+" : "-") + q(r, 2, "0") + ":" + q(e, 2, "0"); | ||
| }, m: function i(n, t) { | ||
| if (n.date() < t.date()) return -i(t, n); | ||
| var r = 12 * (t.year() - n.year()) + (t.month() - n.month()), e = n.clone().add(r, w), a = t - e < 0, u = n.clone().add(r + (a ? -1 : 1), w); | ||
| return +(-(r + (t - e) / (a ? e - u : u - e)) || 0); | ||
| }, a: function(i) { | ||
| return i < 0 ? Math.ceil(i) || 0 : Math.floor(i); | ||
| }, p: function(i) { | ||
| return { M: w, y: k, w: F, d: g, D: H, h: b, m: O, s: D, ms: v, Q: G }[i] || String(i || "").toLowerCase().replace(/s$/, ""); | ||
| }, u: function(i) { | ||
| return i === void 0; | ||
| } }, L = "en", W = {}; | ||
| W[L] = rt; | ||
| var E = "$isDayjsObject", z = function(i) { | ||
| return i instanceof V || !(!i || !i[E]); | ||
| }, N = function i(n, t, r) { | ||
| })(ft, function() { | ||
| var m = 1e3, M = 6e4, O = 36e5, v = "millisecond", y = "second", b = "minute", S = "hour", Y = "day", N = "week", g = "month", G = "quarter", k = "year", j = "date", X = "Invalid Date", st = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, at = /\[([^\]]+)]|Y{1,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, it = { 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("_"), ordinal: function(a) { | ||
| var n = ["th", "st", "nd", "rd"], t = a % 100; | ||
| return "[" + a + (n[(t - 20) % 10] || n[t] || n[0]) + "]"; | ||
| } }, z = function(a, n, t) { | ||
| var r = String(a); | ||
| return !r || r.length >= n ? a : "" + Array(n + 1 - r.length).join(t) + a; | ||
| }, ot = { s: z, z: function(a) { | ||
| var n = -a.utcOffset(), t = Math.abs(n), r = Math.floor(t / 60), e = t % 60; | ||
| return (n <= 0 ? "+" : "-") + z(r, 2, "0") + ":" + z(e, 2, "0"); | ||
| }, m: function a(n, t) { | ||
| if (n.date() < t.date()) return -a(t, n); | ||
| var r = 12 * (t.year() - n.year()) + (t.month() - n.month()), e = n.clone().add(r, g), i = t - e < 0, o = n.clone().add(r + (i ? -1 : 1), g); | ||
| return +(-(r + (t - e) / (i ? e - o : o - e)) || 0); | ||
| }, a: function(a) { | ||
| return a < 0 ? Math.ceil(a) || 0 : Math.floor(a); | ||
| }, p: function(a) { | ||
| return { M: g, y: k, w: N, d: Y, D: j, h: S, m: b, s: y, ms: v, Q: G }[a] || String(a || "").toLowerCase().replace(/s$/, ""); | ||
| }, u: function(a) { | ||
| return a === void 0; | ||
| } }, L = "en", H = {}; | ||
| H[L] = it; | ||
| var E = "$isDayjsObject", P = function(a) { | ||
| return a instanceof J || !(!a || !a[E]); | ||
| }, V = function a(n, t, r) { | ||
| var e; | ||
| if (!n) return L; | ||
| if (typeof n == "string") { | ||
| var a = n.toLowerCase(); | ||
| W[a] && (e = a), t && (W[a] = t, e = a); | ||
| var u = n.split("-"); | ||
| if (!e && u.length > 1) return i(u[0]); | ||
| var i = n.toLowerCase(); | ||
| H[i] && (e = i), t && (H[i] = t, e = i); | ||
| var o = n.split("-"); | ||
| if (!e && o.length > 1) return a(o[0]); | ||
| } else { | ||
| var c = n.name; | ||
| W[c] = n, e = c; | ||
| H[c] = n, e = c; | ||
| } | ||
| return !r && e && (L = e), e || !r && L; | ||
| }, d = function(i, n) { | ||
| if (z(i)) return i.clone(); | ||
| }, d = function(a, n) { | ||
| if (P(a)) return a.clone(); | ||
| var t = typeof n == "object" ? n : {}; | ||
| return t.date = i, t.args = arguments, new V(t); | ||
| }, o = st; | ||
| o.l = N, o.i = z, o.w = function(i, n) { | ||
| return d(i, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset }); | ||
| return t.date = a, t.args = arguments, new J(t); | ||
| }, u = ot; | ||
| u.l = V, u.i = P, u.w = function(a, n) { | ||
| return d(a, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset }); | ||
| }; | ||
| var V = function() { | ||
| function i(t) { | ||
| this.$L = N(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[E] = !0; | ||
| var J = function() { | ||
| function a(t) { | ||
| this.$L = V(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[E] = !0; | ||
| } | ||
| var n = i.prototype; | ||
| var n = a.prototype; | ||
| return n.parse = function(t) { | ||
| this.$d = function(r) { | ||
| var e = r.date, a = r.utc; | ||
| var e = r.date, i = r.utc; | ||
| if (e === null) return /* @__PURE__ */ new Date(NaN); | ||
| if (o.u(e)) return /* @__PURE__ */ new Date(); | ||
| if (u.u(e)) return /* @__PURE__ */ new Date(); | ||
| if (e instanceof Date) return new Date(e); | ||
| if (typeof e == "string" && !/Z$/i.test(e)) { | ||
| var u = e.match(et); | ||
| if (u) { | ||
| var c = u[2] - 1 || 0, f = (u[7] || "0").substring(0, 3); | ||
| return a ? new Date(Date.UTC(u[1], c, u[3] || 1, u[4] || 0, u[5] || 0, u[6] || 0, f)) : new Date(u[1], c, u[3] || 1, u[4] || 0, u[5] || 0, u[6] || 0, f); | ||
| var o = e.match(st); | ||
| if (o) { | ||
| var c = o[2] - 1 || 0, f = (o[7] || "0").substring(0, 3); | ||
| return i ? new Date(Date.UTC(o[1], c, o[3] || 1, o[4] || 0, o[5] || 0, o[6] || 0, f)) : new Date(o[1], c, o[3] || 1, o[4] || 0, o[5] || 0, o[6] || 0, f); | ||
| } | ||
@@ -79,3 +79,3 @@ } | ||
| }, n.$utils = function() { | ||
| return o; | ||
| return u; | ||
| }, n.isValid = function() { | ||
@@ -91,3 +91,3 @@ return this.$d.toString() !== X; | ||
| }, n.$g = function(t, r, e) { | ||
| return o.u(t) ? this[r] : this.set(e, t); | ||
| return u.u(t) ? this[r] : this.set(e, t); | ||
| }, n.unix = function() { | ||
@@ -98,24 +98,24 @@ return Math.floor(this.valueOf() / 1e3); | ||
| }, n.startOf = function(t, r) { | ||
| var e = this, a = !!o.u(r) || r, u = o.p(t), c = function(T, y) { | ||
| var _ = o.w(e.$u ? Date.UTC(e.$y, y, T) : new Date(e.$y, y, T), e); | ||
| return a ? _ : _.endOf(g); | ||
| }, f = function(T, y) { | ||
| return o.w(e.toDate()[T].apply(e.toDate("s"), (a ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(y)), e); | ||
| }, l = this.$W, m = this.$M, p = this.$D, x = "set" + (this.$u ? "UTC" : ""); | ||
| switch (u) { | ||
| var e = this, i = !!u.u(r) || r, o = u.p(t), c = function(W, D) { | ||
| var _ = u.w(e.$u ? Date.UTC(e.$y, D, W) : new Date(e.$y, D, W), e); | ||
| return i ? _ : _.endOf(Y); | ||
| }, f = function(W, D) { | ||
| return u.w(e.toDate()[W].apply(e.toDate("s"), (i ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(D)), e); | ||
| }, l = this.$W, $ = this.$M, p = this.$D, x = "set" + (this.$u ? "UTC" : ""); | ||
| switch (o) { | ||
| case k: | ||
| return a ? c(1, 0) : c(31, 11); | ||
| case w: | ||
| return a ? c(1, m) : c(0, m + 1); | ||
| case F: | ||
| var j = this.$locale().weekStart || 0, C = (l < j ? l + 7 : l) - j; | ||
| return c(a ? p - C : p + (6 - C), m); | ||
| return i ? c(1, 0) : c(31, 11); | ||
| case g: | ||
| case H: | ||
| return i ? c(1, $) : c(0, $ + 1); | ||
| case N: | ||
| var T = this.$locale().weekStart || 0, C = (l < T ? l + 7 : l) - T; | ||
| return c(i ? p - C : p + (6 - C), $); | ||
| case Y: | ||
| case j: | ||
| return f(x + "Hours", 0); | ||
| case S: | ||
| return f(x + "Minutes", 1); | ||
| case b: | ||
| return f(x + "Minutes", 1); | ||
| case O: | ||
| return f(x + "Seconds", 2); | ||
| case D: | ||
| case y: | ||
| return f(x + "Milliseconds", 3); | ||
@@ -128,6 +128,6 @@ default: | ||
| }, n.$set = function(t, r) { | ||
| var e, a = o.p(t), u = "set" + (this.$u ? "UTC" : ""), c = (e = {}, e[g] = u + "Date", e[H] = u + "Date", e[w] = u + "Month", e[k] = u + "FullYear", e[b] = u + "Hours", e[O] = u + "Minutes", e[D] = u + "Seconds", e[v] = u + "Milliseconds", e)[a], f = a === g ? this.$D + (r - this.$W) : r; | ||
| if (a === w || a === k) { | ||
| var l = this.clone().set(H, 1); | ||
| l.$d[c](f), l.init(), this.$d = l.set(H, Math.min(this.$D, l.daysInMonth())).$d; | ||
| var e, i = u.p(t), o = "set" + (this.$u ? "UTC" : ""), c = (e = {}, e[Y] = o + "Date", e[j] = o + "Date", e[g] = o + "Month", e[k] = o + "FullYear", e[S] = o + "Hours", e[b] = o + "Minutes", e[y] = o + "Seconds", e[v] = o + "Milliseconds", e)[i], f = i === Y ? this.$D + (r - this.$W) : r; | ||
| if (i === g || i === k) { | ||
| var l = this.clone().set(j, 1); | ||
| l.$d[c](f), l.init(), this.$d = l.set(j, Math.min(this.$D, l.daysInMonth())).$d; | ||
| } else c && this.$d[c](f); | ||
@@ -138,16 +138,16 @@ return this.init(), this; | ||
| }, n.get = function(t) { | ||
| return this[o.p(t)](); | ||
| return this[u.p(t)](); | ||
| }, n.add = function(t, r) { | ||
| var e, a = this; | ||
| var e, i = this; | ||
| t = Number(t); | ||
| var u = o.p(r), c = function(m) { | ||
| var p = d(a); | ||
| return o.w(p.date(p.date() + Math.round(m * t)), a); | ||
| var o = u.p(r), c = function($) { | ||
| var p = d(i); | ||
| return u.w(p.date(p.date() + Math.round($ * t)), i); | ||
| }; | ||
| if (u === w) return this.set(w, this.$M + t); | ||
| if (u === k) return this.set(k, this.$y + t); | ||
| if (u === g) return c(1); | ||
| if (u === F) return c(7); | ||
| var f = (e = {}, e[O] = M, e[b] = S, e[D] = $, e)[u] || 1, l = this.$d.getTime() + t * f; | ||
| return o.w(l, this); | ||
| if (o === g) return this.set(g, this.$M + t); | ||
| if (o === k) return this.set(k, this.$y + t); | ||
| if (o === Y) return c(1); | ||
| if (o === N) return c(7); | ||
| var f = (e = {}, e[b] = M, e[S] = O, e[y] = m, e)[o] || 1, l = this.$d.getTime() + t * f; | ||
| return u.w(l, this); | ||
| }, n.subtract = function(t, r) { | ||
@@ -158,11 +158,11 @@ return this.add(-1 * t, r); | ||
| if (!this.isValid()) return e.invalidDate || X; | ||
| var a = t || "YYYY-MM-DDTHH:mm:ssZ", u = o.z(this), c = this.$H, f = this.$m, l = this.$M, m = e.weekdays, p = e.months, x = e.meridiem, j = function(y, _, I, J) { | ||
| return y && (y[_] || y(r, a)) || I[_].slice(0, J); | ||
| }, C = function(y) { | ||
| return o.s(c % 12 || 12, y, "0"); | ||
| }, T = x || function(y, _, I) { | ||
| var J = y < 12 ? "AM" : "PM"; | ||
| return I ? J.toLowerCase() : J; | ||
| var i = t || "YYYY-MM-DDTHH:mm:ssZ", o = u.z(this), c = this.$H, f = this.$m, l = this.$M, $ = e.weekdays, p = e.months, x = e.meridiem, T = function(D, _, I, Z) { | ||
| return D && (D[_] || D(r, i)) || I[_].slice(0, Z); | ||
| }, C = function(D) { | ||
| return u.s(c % 12 || 12, D, "0"); | ||
| }, W = x || function(D, _, I) { | ||
| var Z = D < 12 ? "AM" : "PM"; | ||
| return I ? Z.toLowerCase() : Z; | ||
| }; | ||
| return a.replace(nt, function(y, _) { | ||
| return i.replace(at, function(D, _) { | ||
| return _ || function(I) { | ||
@@ -173,27 +173,27 @@ switch (I) { | ||
| case "YYYY": | ||
| return o.s(r.$y, 4, "0"); | ||
| return u.s(r.$y, 4, "0"); | ||
| case "M": | ||
| return l + 1; | ||
| case "MM": | ||
| return o.s(l + 1, 2, "0"); | ||
| return u.s(l + 1, 2, "0"); | ||
| case "MMM": | ||
| return j(e.monthsShort, l, p, 3); | ||
| return T(e.monthsShort, l, p, 3); | ||
| case "MMMM": | ||
| return j(p, l); | ||
| return T(p, l); | ||
| case "D": | ||
| return r.$D; | ||
| case "DD": | ||
| return o.s(r.$D, 2, "0"); | ||
| return u.s(r.$D, 2, "0"); | ||
| case "d": | ||
| return String(r.$W); | ||
| case "dd": | ||
| return j(e.weekdaysMin, r.$W, m, 2); | ||
| return T(e.weekdaysMin, r.$W, $, 2); | ||
| case "ddd": | ||
| return j(e.weekdaysShort, r.$W, m, 3); | ||
| return T(e.weekdaysShort, r.$W, $, 3); | ||
| case "dddd": | ||
| return m[r.$W]; | ||
| return $[r.$W]; | ||
| case "H": | ||
| return String(c); | ||
| case "HH": | ||
| return o.s(c, 2, "0"); | ||
| return u.s(c, 2, "0"); | ||
| case "h": | ||
@@ -204,20 +204,20 @@ return C(1); | ||
| case "a": | ||
| return T(c, f, !0); | ||
| return W(c, f, !0); | ||
| case "A": | ||
| return T(c, f, !1); | ||
| return W(c, f, !1); | ||
| case "m": | ||
| return String(f); | ||
| case "mm": | ||
| return o.s(f, 2, "0"); | ||
| return u.s(f, 2, "0"); | ||
| case "s": | ||
| return String(r.$s); | ||
| case "ss": | ||
| return o.s(r.$s, 2, "0"); | ||
| return u.s(r.$s, 2, "0"); | ||
| case "SSS": | ||
| return o.s(r.$ms, 3, "0"); | ||
| return u.s(r.$ms, 3, "0"); | ||
| case "Z": | ||
| return u; | ||
| return o; | ||
| } | ||
| return null; | ||
| }(y) || u.replace(":", ""); | ||
| }(D) || o.replace(":", ""); | ||
| }); | ||
@@ -227,44 +227,44 @@ }, n.utcOffset = function() { | ||
| }, n.diff = function(t, r, e) { | ||
| var a, u = this, c = o.p(r), f = d(t), l = (f.utcOffset() - this.utcOffset()) * M, m = this - f, p = function() { | ||
| return o.m(u, f); | ||
| var i, o = this, c = u.p(r), f = d(t), l = (f.utcOffset() - this.utcOffset()) * M, $ = this - f, p = function() { | ||
| return u.m(o, f); | ||
| }; | ||
| switch (c) { | ||
| case k: | ||
| a = p() / 12; | ||
| i = p() / 12; | ||
| break; | ||
| case w: | ||
| a = p(); | ||
| case g: | ||
| i = p(); | ||
| break; | ||
| case G: | ||
| a = p() / 3; | ||
| i = p() / 3; | ||
| break; | ||
| case F: | ||
| a = (m - l) / 6048e5; | ||
| case N: | ||
| i = ($ - l) / 6048e5; | ||
| break; | ||
| case g: | ||
| a = (m - l) / 864e5; | ||
| case Y: | ||
| i = ($ - l) / 864e5; | ||
| break; | ||
| case S: | ||
| i = $ / O; | ||
| break; | ||
| case b: | ||
| a = m / S; | ||
| i = $ / M; | ||
| break; | ||
| case O: | ||
| a = m / M; | ||
| case y: | ||
| i = $ / m; | ||
| break; | ||
| case D: | ||
| a = m / $; | ||
| break; | ||
| default: | ||
| a = m; | ||
| i = $; | ||
| } | ||
| return e ? a : o.a(a); | ||
| return e ? i : u.a(i); | ||
| }, n.daysInMonth = function() { | ||
| return this.endOf(w).$D; | ||
| return this.endOf(g).$D; | ||
| }, n.$locale = function() { | ||
| return W[this.$L]; | ||
| return H[this.$L]; | ||
| }, n.locale = function(t, r) { | ||
| if (!t) return this.$L; | ||
| var e = this.clone(), a = N(t, r, !0); | ||
| return a && (e.$L = a), e; | ||
| var e = this.clone(), i = V(t, r, !0); | ||
| return i && (e.$L = i), e; | ||
| }, n.clone = function() { | ||
| return o.w(this.$d, this); | ||
| return u.w(this.$d, this); | ||
| }, n.toDate = function() { | ||
@@ -278,19 +278,19 @@ return new Date(this.valueOf()); | ||
| return this.$d.toUTCString(); | ||
| }, i; | ||
| }(), K = V.prototype; | ||
| return d.prototype = K, [["$ms", v], ["$s", D], ["$m", O], ["$H", b], ["$W", g], ["$M", w], ["$y", k], ["$D", H]].forEach(function(i) { | ||
| K[i[1]] = function(n) { | ||
| return this.$g(n, i[0], i[1]); | ||
| }, a; | ||
| }(), K = J.prototype; | ||
| return d.prototype = K, [["$ms", v], ["$s", y], ["$m", b], ["$H", S], ["$W", Y], ["$M", g], ["$y", k], ["$D", j]].forEach(function(a) { | ||
| K[a[1]] = function(n) { | ||
| return this.$g(n, a[0], a[1]); | ||
| }; | ||
| }), d.extend = function(i, n) { | ||
| return i.$i || (i(n, V, d), i.$i = !0), d; | ||
| }, d.locale = N, d.isDayjs = z, d.unix = function(i) { | ||
| return d(1e3 * i); | ||
| }, d.en = W[L], d.Ls = W, d.p = {}, d; | ||
| }), d.extend = function(a, n) { | ||
| return a.$i || (a(n, J, d), a.$i = !0), d; | ||
| }, d.locale = V, d.isDayjs = P, d.unix = function(a) { | ||
| return d(1e3 * a); | ||
| }, d.en = H[L], d.Ls = H, d.p = {}, d; | ||
| }); | ||
| }(Z)), Z.exports; | ||
| }(q)), q.exports; | ||
| } | ||
| var ct = ot(); | ||
| const A = /* @__PURE__ */ at(ct); | ||
| function Mt(s) { | ||
| var dt = ht(); | ||
| const A = /* @__PURE__ */ ct(dt); | ||
| function pt(s) { | ||
| if (!s || !s.trim()) | ||
@@ -301,6 +301,6 @@ return ""; | ||
| return ""; | ||
| const $ = P(s), M = h.format("HH:mm"); | ||
| return `${$} ${M}`; | ||
| const m = B(s), M = h.format("HH:mm"); | ||
| return `${m} ${M}`; | ||
| } | ||
| function P(s) { | ||
| function B(s) { | ||
| if (!s || !s.trim()) | ||
@@ -311,52 +311,64 @@ return ""; | ||
| } | ||
| function yt(s, h) { | ||
| const $ = [s, h].filter((D) => D !== "" && D && D !== "0000-00-00"); | ||
| if ($.length === 1 || $[0] === $[1]) | ||
| return P($[0]); | ||
| const M = A(s), S = A(h), v = { | ||
| function vt(s, h) { | ||
| const m = [s, h].filter((y) => y !== "" && y && y !== "0000-00-00"); | ||
| if (m.length === 1 || m[0] === m[1]) | ||
| return B(m[0]); | ||
| const M = A(s), O = A(h), v = { | ||
| shortDate: "MM/DD", | ||
| fullDate: "YYYY/MM/DD" | ||
| }; | ||
| return M.isSame(h, "year") ? [P(s), S.format(v.shortDate)].join(" - ") : [M.format(v.fullDate), S.format(v.fullDate)].join(" - "); | ||
| return M.isSame(h, "year") ? [B(s), O.format(v.shortDate)].join(" - ") : [M.format(v.fullDate), O.format(v.fullDate)].join(" - "); | ||
| } | ||
| const ft = (s, h = !1) => { | ||
| const $ = h ? Math.floor(s / 60 / 60 / 24) : 0, M = Math.floor(h ? s / 60 / 60 % 24 : s / 3600), S = Math.floor(s % 3600 / 60), v = s % 60; | ||
| return { days: $, hours: M, minutes: S, seconds: v }; | ||
| }, Dt = (s, h = !1) => { | ||
| const { hours: $, minutes: M, seconds: S } = ft(s, !1), v = [$, M, S]; | ||
| let D = 0; | ||
| return v.reduce((O, b, g) => D >= g && h && b === 0 ? (D = g, O) : [...O, it(b, 2)], []).join(":"); | ||
| }, pt = (s, h = !1) => { | ||
| const $ = s / 1e3; | ||
| return h ? Math.floor($) : $; | ||
| }, ht = (s) => s * 60 * 1e3, dt = (s) => ht(s * 60), vt = (s) => dt(s * 24), Y = A(), U = Y.day(0), B = U.subtract(7, "day"), Q = U.subtract(14, "day"), R = Y.set("date", 1), lt = Y.subtract(6, "month"), gt = { | ||
| today: Y, | ||
| const lt = (s, h = !1) => { | ||
| const m = h ? Math.floor(s / 60 / 60 / 24) : 0, M = Math.floor(h ? s / 60 / 60 % 24 : s / 3600), O = Math.floor(s % 3600 / 60), v = s % 60; | ||
| return { days: m, hours: M, minutes: O, seconds: v }; | ||
| }, Yt = (s, h = !1) => { | ||
| const { hours: m, minutes: M, seconds: O } = lt(s, !1), v = [m, M, O]; | ||
| let y = 0; | ||
| return v.reduce((b, S, Y) => y >= Y && h && S === 0 ? (y = Y, b) : [...b, ut(S, 2)], []).join(":"); | ||
| }, gt = (s, h = !1) => { | ||
| const m = s / 1e3; | ||
| return h ? Math.floor(m) : m; | ||
| }, mt = (s) => s * 60 * 1e3, $t = (s) => mt(s * 60), wt = (s) => $t(s * 24), w = A(), U = w.day(0), Q = U.subtract(7, "day"), R = U.subtract(14, "day"), F = w.set("date", 1), et = F.subtract(1, "month"), nt = F.subtract(2, "month"), rt = w.set("month", 0).set("date", 1), Mt = w.subtract(6, "month"), Ot = { | ||
| today: w, | ||
| thisWeek: U, | ||
| lastWeek: B, | ||
| twoWeekAgo: Q, | ||
| thisMonth: R, | ||
| halfYearAgo: lt | ||
| lastWeek: Q, | ||
| twoWeekAgo: R, | ||
| thisMonth: F, | ||
| halfYearAgo: Mt | ||
| }, bt = { | ||
| date: "YYYY/MM/DD", | ||
| dateDash: "YYYY-MM-DD", | ||
| dateTime: "YYYY/MM/DD HH:mm:ss", | ||
| shortDateTime: "YYYY/MM/DD HH:mm", | ||
| shortTime: "HH:mm", | ||
| time: "HH:mm:ss" | ||
| }; | ||
| var $t = /* @__PURE__ */ ((s) => (s.today = "today", s.yesterday = "yesterday", s.thisWeek = "thisWeek", s.lastWeek = "lastWeek", s.twoWeekAgo = "twoWeekAgo", s.thisMonth = "thisMonth", s))($t || {}); | ||
| const wt = { | ||
| today: { startDate: Y, endDate: Y }, | ||
| yesterday: { startDate: Y.subtract(1, "day"), endDate: Y.subtract(1, "day") }, | ||
| var Dt = /* @__PURE__ */ ((s) => (s.today = "today", s.yesterday = "yesterday", s.thisWeek = "thisWeek", s.lastWeek = "lastWeek", s.twoWeekAgo = "twoWeekAgo", s.thisMonth = "thisMonth", s.lastMonth = "lastMonth", s.twoMonth = "twoMonth", s.thisHalfYear = "thisHalfYear", s.thisYear = "thisYear", s))(Dt || {}); | ||
| const St = { | ||
| today: { startDate: w, endDate: w }, | ||
| yesterday: { startDate: w.subtract(1, "day"), endDate: w.subtract(1, "day") }, | ||
| thisWeek: { startDate: U, endDate: U.add(6, "day") }, | ||
| lastWeek: { startDate: B, endDate: B.add(6, "day") }, | ||
| twoWeekAgo: { startDate: Q, endDate: Q.add(6, "day") }, | ||
| thisMonth: { startDate: R, endDate: R.endOf("month") } | ||
| lastWeek: { startDate: Q, endDate: Q.add(6, "day") }, | ||
| twoWeekAgo: { startDate: R, endDate: R.add(6, "day") }, | ||
| thisMonth: { startDate: F, endDate: F.endOf("month") }, | ||
| lastMonth: { startDate: et, endDate: et.endOf("month") }, | ||
| twoMonth: { startDate: nt, endDate: nt.endOf("month") }, | ||
| thisHalfYear: { startDate: w.subtract(6, "month"), endDate: w }, | ||
| thisYear: { startDate: rt, endDate: rt.endOf("year") } | ||
| }; | ||
| export { | ||
| $t as EDayKey, | ||
| gt as dateUtils, | ||
| wt as dayList, | ||
| vt as dayToMillisecond, | ||
| Dt as formatSecondToString, | ||
| ft as formatTotalSeconds, | ||
| dt as hourToMillisecond, | ||
| pt as millisecondToSeconds, | ||
| ht as minuteToMillisecond, | ||
| yt as rangeSimpleDate, | ||
| P as simpleDate, | ||
| Mt as simpleDateTime | ||
| Dt as EDayKey, | ||
| Ot as dateUtils, | ||
| St as dayList, | ||
| wt as dayToMillisecond, | ||
| bt as format, | ||
| Yt as formatSecondToString, | ||
| lt as formatTotalSeconds, | ||
| $t as hourToMillisecond, | ||
| gt as millisecondToSeconds, | ||
| mt as minuteToMillisecond, | ||
| vt as rangeSimpleDate, | ||
| B as simpleDate, | ||
| pt as simpleDateTime | ||
| }; |
+1
-1
| { | ||
| "name": "@acrool/js-utils", | ||
| "version": "3.2.24", | ||
| "version": "3.2.25-alpha.0", | ||
| "description": "Common javascript utils methods for project development", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
106251
1.51%2331
1.35%14
7.69%