| 1 |
- import{a as g,bK as i,r as D,k as O,f3 as b,aa as M,f4 as S,e_ as E,c2 as _,j as N,ac as w,bL as I,c0 as x,o as y,e as B,z as $,X as k}from"./index.ae52ebae.js";const T=1e3,l=T*60,m=l*60,d=m*24,H=g({name:"Time",props:{value:i.oneOfType([i.number,i.instanceOf(Date),i.string]).isRequired,step:i.number.def(60),mode:i.oneOf(["date","datetime","relative"]).def("relative"),isSuffix:i.bool.def(!0)},setup(s){const f=D(""),{t:o}=O();b(p,s.step*T),M(()=>s.value,()=>{p()},{immediate:!0});function v(){const{value:e}=s;let n=0;if(w(e)){const a=e.toString().length>10?e:e*1e3;n=new Date(a).getTime()}else I(e)?n=new Date(e).getTime():x(e)&&(n=e.getTime());return n}function p(){const{mode:e,value:n}=s,a=v();e==="relative"?f.value=h(a):e==="datetime"?f.value=S(n):e==="date"&&(f.value=E(n))}function h(e){const n=new Date().getTime(),a=_(e).isBefore(n);let t=n-e;a||(t=-t);let r="",u="";if(s.isSuffix&&(u=o(a?"component.time.before":"component.time.after")),t<l)r=parseInt(t/T)+o("component.time.seconds")+u;else if(t>=l&&t<m)r=Math.floor(t/l)+o("component.time.minutes")+u;else if(t>=m&&t<d){const c=Math.floor(t%m/l);r=Math.floor(t/m)+o("component.time.hours")+(c>0?" "+c+o("component.time.minutes"):"")}else if(t>=d&&t<3156786e4*1e3*50){const c=Math.floor(t%d/m);r=Math.floor(t/d)+o("component.time.days")+(c>0?" "+c+o("component.time.hours"):"")+u}else r=_(e).format("MM-DD-HH-mm");return r}return{date:f}}});function R(s,f,o,v,p,h){return y(),B("span",null,$(s.date),1)}var U=N(H,[["render",R]]);const C=k(U);export{C as T};
|