You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
1.3 KiB
2 lines
1.3 KiB
import{d as D,ay as r,r as O,e as _,e3 as h,O as E,e4 as N,al as M,aY as p,aZ as Y,ak as b,aX as y,aT as S,o as w,g as B,t as I}from"./index-f4658ae7.js";const l=1e3,c=l*60,u=c*60,T=u*24,$=D({name:"Time",props:{value:r.oneOfType([r.number,r.instanceOf(Date),r.string]).isRequired,step:r.number.def(60),mode:r.oneOf(["date","datetime","relative"]).def("relative")},setup(i){const m=O(""),{t:s}=_();h(d,i.step*l),E(()=>i.value,()=>{d()},{immediate:!0});function g(){const{value:e}=i;let n=0;if(Y(e)){const o=e.toString().length>10?e:e*1e3;n=new Date(o).getTime()}else b(e)?n=new Date(e).getTime():y(e)&&(n=e.getTime());return n}function d(){const{mode:e,value:n}=i,o=g();e==="relative"?m.value=v(o):e==="datetime"?m.value=N(n):e==="date"&&(m.value=M(n))}function v(e){const n=new Date().getTime(),o=p(e).isBefore(n);let t=n-e;o||(t=-t);let a="",f=s(o?"component.time.before":"component.time.after");return t<l?a=s("component.time.just"):t<c?a=parseInt(t/l)+s("component.time.seconds")+f:t>=c&&t<u?a=Math.floor(t/c)+s("component.time.minutes")+f:t>=u&&t<T?a=Math.floor(t/u)+s("component.time.hours")+f:t>=T&&t<262386e4?a=Math.floor(t/T)+s("component.time.days")+f:t>=262386e4&&t<=3156786e4&&o?a=p(e).format("MM-DD-HH-mm"):a=p(e).format("YYYY"),a}return{date:m}}});function k(i,m,s,g,d,v){return w(),B("span",null,I(i.date),1)}const R=S($,[["render",k]]);export{R as default};
|