"use strict";const i=require("dayjs"),s=require("./base-iCmnU-fv.cjs");require("dayjs/locale/zh-cn");require("dayjs/locale/en");const c=require("dayjs/plugin/localeData"),m=require("dayjs/plugin/objectSupport"),o=require("dayjs/plugin/isSameOrAfter"),u=require("dayjs/plugin/isSameOrBefore"),l=require("dayjs/plugin/isoWeek"),D=require("dayjs-lunar"),j=require("dayjs/plugin/utc"),f=require("dayjs/plugin/timezone");i.locale("zh-cn");i.extend(c);i.extend(m);i.extend(o);i.extend(u);i.extend(l);i.extend(j);i.extend(f);i.extend(D);class n{static objDay=i;static timezone="PRC";static initDay(e){return(s.CommonBase.isUndefined(e)?i():e).tz(this.timezone)}static getDayjsObject(e){if(s.CommonBase.isEmpty(e))return this.initDay(i());if(i.isDayjs(e))return this.initDay(e.clone());let t;return s.CommonBase.isString(e)?t=e.replace(/[/]/g,"-").replace(/：/g,":"):s.CommonBase.isInt(e)?t=new Date(parseInt(e,10)):s.CommonBase.isObject(e)&&(t=e),this.initDay(i(t,"YYYY-MM-DD HH:mm:ss"))}static initFormat(e){let t={value:"",format:"YYYY-MM-DD"},r;return s.CommonBase.isObject(e)?i.isDayjs(e)?r=e:(e.format&&(t=s.CommonBase.getJsonMerge(t,e)),e.value||e.format?r=this.getDayjsObject(e.value||""):r=this.getDayjsObject(e)):r=this.getDayjsObject(e),r.format(t.format)}static addTime(e,t,r="days"){return this.getDayjsObject(e).add(t,r)}static subtractTime(e,t,r="days"){return this.getDayjsObject(e).subtract(t,r)}static diffTime(e,t,r="millisecond"){return this.getDayjsObject(e).diff(this.getDayjsObject(t),r)}static lunar(e){return this.getDayjsObject(e).lunar()}}s.registerFormatHandler("date",(a,e)=>n.initFormat({value:a,format:e}));s.registerFormatHandler("dateTime",(a,e)=>n.initFormat({value:a,format:e}));s.registerFormatHandler("time",(a,e)=>n.initFormat({value:a,format:e}));exports.CommDay=n;
//# sourceMappingURL=day-BzMalBXj.cjs.map
