import{_ as i,d as f,k as m,a as g,u as c,T as p,e as _,o as v}from"./app-D7zH3Nl5.js";import{R as y}from"./dayjs-Bh5BavPT.js";const R=f({props:{dateRange:{default:[]},formatType:{default:"YYYY-MM-DD HH:mm:ss"},showPreset:{default:!0,type:Boolean}},emits:["dateTimeChanged"],setup(e,{emit:d}){const o=m([]),{appSetting:r,dayjs:a}=g(),{t}=c();p(()=>{e.dateRange&&e.dateRange.length>0&&(o.value=[a(e.dateRange[0]),a(e.dateRange[1])])});const s=n=>{n?d("dateTimeChanged",[n[0].tz(r.value.timezone).utc().format(e.formatType),n[1].tz(r.value.timezone).utc().format(e.formatType)]):d("dateTimeChanged",[])},l=n=>{o.value=n,s(n)},u=()=>{o.value=[]},h=m([{label:t("hrm_dashboard.yesterday"),value:[a().add(-1,"d").startOf("day"),a().add(-1,"d").endOf("day")]},{label:t("hrm_dashboard.today"),value:[a(),a()]},{label:t("hrm_dashboard.this_week"),value:[a().add(-7,"d"),a()]},{label:t("hrm_dashboard.this_month"),value:[a().startOf("month"),a()]},{label:t("hrm_dashboard.this_year"),value:[a().startOf("year"),a()]}]);return{appSetting:r,dateRangeValue:o,dateTimeChanged:s,resetPicker:u,setDatePicker:l,rangePresets:h}}});function b(e,d,o,r,a,t){const s=y;return v(),_(s,{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 C=i(R,[["render",b]]);export{C as D};
