"use strict";const t=require("../vendor.js");t.dayjs.locale("zh-cn"),t.dayjs.extend(t.relativeTime);exports.ShowLastTime=function(e){return e?t.dayjs(e).fromNow():"-"},exports.getDay=function(e){if(e){const s=t.dayjs().subtract(e,"day");return console.log(s.format("YYYY-MM-DD")),s.format("YYYY-MM-DD")}return t.dayjs().format("YYYY-MM-DD")},exports.getDayTime=function(e){if(e){let s=null==e?void 0:e.replace(/-/g,"/");return t.dayjs(s).format("YYYY-MM-DD HH:mm")}return t.dayjs().format("YYYY-MM-DD HH:mm")},exports.getShowDay=e=>{const s=t.dayjs(e).startOf("day"),r=t.dayjs().startOf("day"),a=r.subtract(1,"day"),o=r.add(1,"day"),n={0:"星期日",1:"星期一",2:"星期二",3:"星期三",4:"星期四",5:"星期五",6:"星期六"}[s.day()];return s.isSame(r,"day")?`今天 ${n}`:s.isSame(a,"day")?`昨天 ${n}`:s.isSame(o,"day")?`明天 ${n}`:`${e} ${n}`},exports.getTime=function(){return t.dayjs().format("YYYY-MM-DD HH:mm:ss")},exports.getTimeStatus=function(e){const s=t.dayjs(),r=t.dayjs(e);if(r.isBefore(s)){const t=s.diff(r,"hour"),e=s.diff(r,"minute")%60;let a="已过期望处理时间：";return t>0&&(a+=`${t}个小时`),e>0&&(a+=`${e}分钟`),{label:a,status:"4",color:"#EA0000"}}{const t=r.diff(s,"hour"),e=r.diff(s,"minute")%60;let a,o;t>=24?(a="1",o="#24BC21"):t>=2?(a="2",o="#0082FA"):(a="3",o="#F97316");const n=Math.floor(t/24),i=t%24;let d="上门时间还剩：";return n>0&&(d+=`${n}天`),i>0&&(d+=`${i}个小时`),e>0&&(d+=`${e}分钟`),{label:d,status:a,color:o}}},exports.isDatePassed=function(e){return console.log(t.dayjs().isAfter(t.dayjs(e)),"dayjs().isAfter(dayjs(fixedDate))"),t.dayjs().isAfter(t.dayjs(e),"day")},exports.isOverHalfHourPast=function(e){let s=null==e?void 0:e.replace(/-/g,"/");const r=t.dayjs(),a=t.dayjs(s);return r.diff(a,"minute")>30},exports.isWithinTimeRange=function(e,s=30){let r=null==e?void 0:e.replace(/-/g,"/");console.log(e,r,"targetTime");const a=t.dayjs(),o=t.dayjs(r),n=o.startOf("day"),i=o.endOf("day");return a.isAfter(n)&&a.isBefore(i)},exports.showCurrentTime=function(){return t.dayjs().format("HH:mm")},exports.showDay=function(e){return e?t.dayjs(e).format("YYYY-MM-DD"):"-"},exports.showTime=function(e){let s=null==e?void 0:e.replace(/-/g,"/");return s?t.dayjs(s).format("HH:mm"):""},exports.showWeekDay=function(){return{0:"星期日",1:"星期一",2:"星期二",3:"星期三",4:"星期四",5:"星期五",6:"星期六"}[t.dayjs().day()]},exports.specificTime=function(e){let s=null==e?void 0:e.replace(/-/g,"/");const r=t.dayjs(),a=t.dayjs(s);let o=Math.abs(a.diff(r,"hour",!0))<=2||a.isBefore(r);return console.log(o,"hoursDiff"),o};
