"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[8333],{8333(e,t,a){a.r(t),a.d(t,{default:()=>s});var r=a(1609),n=a(6087),i=(a(7723),a(6723));const s=({field:e})=>{const t=(0,n.useRef)(),a=(0,n.useRef)();(0,n.useEffect)(()=>{if(!a.current)return;const t=jQuery,r=t(a.current);r.hasClass("hasDatepicker")&&r.datepicker("destroy"),r.datetimepicker({showButtonPanel:!0,changeYear:!0,changeMonth:!0,oneLine:!0,controlType:"select",altFieldTimeOnly:!1});const n=(e=>{if(!e||"object"!=typeof e)return{};const t={};return Object.values(e).forEach(e=>{e&&e.key&&(t[e.key]=e.value)}),t})(e.js_options),i=n.separator||" ",s=e.datetime_format||"",c=s.indexOf(i),l=-1!==c?s.substring(0,c):s,o=-1!==c?s.substring(c+i.length):"",p=n.dateFormat||l,m=n.timeFormat||o,d=e.std||"",[u]=d.split(i);try{p&&u&&t.datepicker.parseDate(p,u),p&&r.datetimepicker("option","dateFormat",p),m&&r.datetimepicker("option","timeFormat",m),d&&r.datetimepicker("setDate",d)}catch(t){console.error(`ERROR: Field ${e.name}: invalid format for the datetime picker default value`)}},[e.format,e.std,e.inline]);const s=e.prepend&&(0,r.createElement)("span",{className:"rwmb-input-group-text"},e.prepend),c=e.append&&(0,r.createElement)("span",{className:"rwmb-input-group-text"},e.append),l=(0,r.createElement)("input",{ref:t,type:"text",placeholder:e.placeholder,size:e.size,value:e.std||"",onChange:i.Zi});return(0,r.createElement)(r.Fragment,null,s||c?(0,r.createElement)("div",{className:"rwmb-input-group"},s,l,c):l,e.inline&&(0,r.createElement)("div",{ref:a,className:"rwmb-datetime-inline"}))}}}]);