diff --git a/package.json b/package.json index 265f4ff..9c9f024 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@indec/react-commons", - "version": "5.6.0", + "version": "5.6.1", "description": "Common reactjs components for apps", "private": false, "main": "index.js", diff --git a/src/components/DatePicker/DatePicker.js b/src/components/DatePicker/DatePicker.js index e8785d1..41127ea 100644 --- a/src/components/DatePicker/DatePicker.js +++ b/src/components/DatePicker/DatePicker.js @@ -27,8 +27,12 @@ const DatePicker = ({ yearRange, ...props }) => { - const handleChange = newValue => form?.setFieldValue(field.name, newValue) - || onChange({target: {id: name, value: newValue}}); + const handleChange = newValue => { + const dateToISOString = newValue.toISOString(); + return onChange + ? onChange({target: {id: name, value: dateToISOString}}) + : form.setFieldValue(field.name, dateToISOString); + }; const customHeader = isCustomHeader ? { renderCustomHeader: datePickerProps => ( @@ -110,7 +114,7 @@ DatePicker.defaultProps = { variant: undefined, isDisabled: false, isCustomHeader: false, - onChange: () => {}, + onChange: undefined, form: undefined, field: undefined, selectsStart: false,