import{Q as l}from"./vendor-datepicker--1DmXemW.js";import{d as h,e as $,a as H,w as M,f as S,i as b,x as n,j as d,m as f}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{t as D,r as p,u as g}from"./vendor-vue-reactivity-CheHbvBM.js";import"./vendor-vue-runtime-dom-B2rky8vu.js";import"./vendor-vue-shared-DrzsEcag.js";import"./vendor-date-fns-DoIqsk4U.js";const P={class:"ccb-range-timePicker"},x={class:"ccb-range-timePicker__from"},F={class:"ccb-range-timePicker__to"},U=h({__name:"RangeTime",props:{field:{}},emits:["update:modelValue"],setup(v,{emit:k}){const V=v,c=k,{field:_}=D(V),s=p(new Date),a=p(new Date),m=$(()=>{var e,t;return((t=(e=_.value)==null?void 0:e.attributes)==null?void 0:t.format)||!1}),i=e=>{const{hours:t,minutes:o}=e,r=o.toString().padStart(2,"0");if(m.value)return`${t.toString().padStart(2,"0")}:${r}`;{const u=t>=12?"PM":"AM";return`${t%12||12}:${r} ${u}`}};return H(()=>{if(s.value instanceof Date&&a.value instanceof Date){const e={hours:s.value.getHours(),minutes:s.value.getMinutes(),seconds:s.value.getSeconds()},t={hours:a.value.getHours(),minutes:a.value.getMinutes(),seconds:a.value.getSeconds()},o=i(e),r=i(t);c("update:modelValue",`${o} - ${r}`)}}),M([s,a],e=>{if(!Array.isArray(e))return;const t=e[0]instanceof Date?{hours:e[0].getHours(),minutes:e[0].getMinutes(),seconds:e[0].getSeconds()}:e[0],o=e[1]instanceof Date?{hours:e[1].getHours(),minutes:e[1].getMinutes(),seconds:e[1].getSeconds()}:e[1],r=i(t),u=i(o);c("update:modelValue",`${r} - ${u}`)}),(e,t)=>(b(),S("div",P,[n("div",x,[d(g(l),{modelValue:s.value,"onUpdate:modelValue":t[0]||(t[0]=o=>s.value=o),"time-picker":"","is-24":m.value,"minutes-grid-increment":"5",placeholder:"hh:mm"},{"input-icon":f(()=>t[2]||(t[2]=[n("i",{class:"ccb-icon-timepicker-light-clock"},null,-1)])),_:1},8,["modelValue","is-24"])]),t[4]||(t[4]=n("div",{class:"ccb-range-timePicker__separator"},[n("span",null,"to")],-1)),n("div",F,[d(g(l),{modelValue:a.value,"onUpdate:modelValue":t[1]||(t[1]=o=>a.value=o),"time-picker":"","is-24":m.value,"minutes-grid-increment":"5",placeholder:"hh:mm"},{"input-icon":f(()=>t[3]||(t[3]=[n("i",{class:"ccb-icon-timepicker-light-clock"},null,-1)])),_:1},8,["modelValue","is-24"])])]))}});export{U as default};
//# sourceMappingURL=RangeTime-CJduuQOf.js.map
