Liferay.Loader.define("segments-web@3.0.77/js/components/inputs/DateTimeInput.es",["module","exports","require","segments-web$date-fns","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../utils/constants.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(a("segments-web$date-fns")),r=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(a("liferay!frontend-js-react-web$react"))),s=a("../../utils/constants.es");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const e="YYYY-MM-DD";class DateTimeInput extends r.default.Component{constructor(...t){super(...t),_defineProperty(this,"state",{}),_defineProperty(this,"_handleDateChange",(e=>{const t=e.target.value;this.setState({value:t})})),_defineProperty(this,"_handleDateBlur",(t=>{const a=n.default.format(t.target.value,e);if("Invalid Date"!==a)this.setState({value:a},(()=>{this.props.onChange({type:s.PROPERTY_TYPES.DATE_TIME,value:n.default.parse(a,e).toISOString()})}));else{const t=n.default.format(new Date,e);this.setState({value:t},(()=>{this.props.onChange({type:s.PROPERTY_TYPES.DATE_TIME,value:n.default.parse(t,e).toISOString()})}))}}))}static getDerivedStateFromProps(t,a){let r=null;return t.value!==a.initialValue&&(r={initialValue:t.value,value:n.default.format(new Date(t.value),e)}),r}render(){const{value:e}=this.state,{disabled:t,propertyLabel:a}=this.props;return r.default.createElement("div",{className:"criterion-input date-input"},r.default.createElement("input",{"aria-label":"".concat(a,": ").concat(Liferay.Language.get("select-date")),className:"form-control","data-testid":"date-input",disabled:t,onBlur:this._handleDateBlur,onChange:this._handleDateChange,type:"date",value:e}))}}var i=DateTimeInput;t.default=i}}));
//# sourceMappingURL=DateTimeInput.es.js.map