import{_ as i,x as c,r as f,a as g,b as h,E as y,o as p,f as v,cq as b}from"./app-DGDivIsO.js";const _=c({props:{dateRange:{default:[]},formatType:{default:"YYYY-MM-DD HH:mm:ss"},showPreset:{default:!0,type:Boolean}},emits:["dateTimeChanged"],setup(e,{emit:d}){const s=f([]),{appSetting:o,dayjs:a}=g(),{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=n=>{n?d("dateTimeChanged",[n[0].tz(o.value.timezone).startOf("day").utc().format(e.formatType),n[1].tz(o.value.timezone).endOf("day").utc().format(e.formatType)]):d("dateTimeChanged",[])},l=()=>{s.value=[]},u=n=>{s.value=n,r(n)},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,d,s,o,a,t){const r=b;return p(),v(r,{value:e.dateRangeValue,"onUpdate:value":d[0]||(d[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};
