import{_ as i,d as g,f,b as c,Y as h,E as y,o as p,i as v,bH as b}from"./app-DyK1k-lL.js";const _=g({props:{dateRange:{default:[]},formatType:{default:"YYYY-MM-DD HH:mm:ss"},showPreset:{default:!0,type:Boolean}},emits:["dateTimeChanged"],setup(e,{emit:n}){const s=f([]),{appSetting:o,dayjs:a}=c(),{t}=h();y(()=>{e.dateRange&&e.dateRange.length>0&&(s.value=[a(e.dateRange[0]),a(e.dateRange[1])]),e.showPreset||(m.value=[])});const r=d=>{d?n("dateTimeChanged",[d[0].tz(o.value.timezone).startOf("day").utc().format(e.formatType),d[1].tz(o.value.timezone).endOf("day").utc().format(e.formatType)]):n("dateTimeChanged",[])},l=()=>{s.value=[]},u=d=>{s.value=d,r(d)},m=f([{label:t("dashboard.yesterday"),value:[a().add(-1,"d").startOf("day"),a().add(-1,"d").endOf("day")]},{label:t("dashboard.today"),value:[a(),a()]},{label:t("dashboard.last_7_days"),value:[a().add(-7,"d"),a()]},{label:t("dashboard.this_month"),value:[a().startOf("month"),a()]},{label:t("dashboard.this_year"),value:[a().startOf("year"),a()]}]);return{appSetting:o,dateRangeValue:s,dateTimeChanged:r,resetPicker:l,setDatePicker:u,rangePresets:m}}});function R(e,n,s,o,a,t){const r=b;return p(),v(r,{value:e.dateRangeValue,"onUpdate:value":n[0]||(n[0]=l=>e.dateRangeValue=l),format:e.appSetting.date_format,placeholder:[e.$t("common.start_date"),e.$t("common.end_date")],style:{width:"100%"},onChange:e.dateTimeChanged,presets:e.rangePresets},null,8,["value","format","placeholder","onChange","presets"])}const P=i(_,[["render",R]]);export{P as D};
