import{u as w,j as m,P as x}from"./vendor-laZsiqLO.js";import{c as d}from"./utils-RgT4yCq8.js";import{u as g}from"./useTranslation-BW0o-tkY.js";function M({date:t,showIcon:u=!0,className:f}){const{locale:r}=w().props,{t:l}=g();if(!t)return null;const s=r?r.replace("_","-"):"en",p=h=>{const a=new Date(h),c=Math.floor((new Date-a)/1e3);if(c<60)return l("_just_now","Just now");const e=new Intl.RelativeTimeFormat(s,{numeric:"auto"}),o=Math.floor(c/60),n=Math.floor(o/60),i=Math.floor(n/24);return o<60?e.format(-o,"minute"):n<24?e.format(-n,"hour"):i<7?e.format(-i,"day"):new Intl.DateTimeFormat(s,{year:"numeric",month:"short",day:"numeric"}).format(a)};return m.jsxs("span",{className:d("flex items-center gap-1 text-xs text-muted-foreground",f),title:new Date(t).toLocaleString(),children:[u&&m.jsx(x,{className:"w-3 h-3"}),p(t)]})}export{M as T};
