const t=t=>{const e=new Date(t);return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`},e=t=>{const e=new Date(t);if(isNaN(e.getTime()))return console.error("Invalid date:",t),"--.--";return`${String(e.getMonth()+1).padStart(2,"0")}.${String(e.getDate()).padStart(2,"0")}`};function r(t){const e=t.replace(/-/g,"/"),r=new Date(e),a=new Date,n=a-r;if(n<0)return t;const o=Math.floor(n/1e3),s=Math.floor(o/60),i=Math.floor(s/60),g=Math.floor(i/24),u=(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate();return o<60?"刚刚":s<60?`${s}分钟前`:i<24&&u(r,a)?`${i}小时前`:((t,e)=>{const r=new Date(e);return r.setDate(e.getDate()-1),u(t,r)})(r,a)?"昨天":g<7?`${g}天前`:t.split(" ")[0]}const a=t=>{const e=new Date(t);if(isNaN(e.getTime()))throw new Error("Invalid date string");return{day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds()}},n=t=>{const e=(new Date).getTime(),r=new Date(t.replace(" ","T")).getTime();if(isNaN(r))throw new Error("无效的结束时间格式");const a=r-e;if(a<=0)return{day:0,hour:0,minute:0,second:0,isExpired:!0};const n=Math.floor(a/1e3);return{day:Math.floor(n/86400),hour:Math.floor(n%86400/3600),minute:Math.floor(n%3600/60),second:n%60,isExpired:!1}};export{t as a,r as b,e as f,n as g,a as p};