1

I'm trying to use react-datepicker form with formik and I don't have possibility to input value manually. I have to choose date first so that I can edit date manually, but I can't write it.

Did anyone have such problem?

const DateComponent = ({...props}) => {
    const setFieldValue = useFormikContext()
    const [field] = useField(props)
    const onChange = (value) => {
      setFieldValue(field.name, value)
    }
    return(
        <DatePicker 
        {...field}
        {...props}
        selected={field.value && new Date(field.value) || null}
        onChange={onChange}
        customInput={<Input />}
        dateFormat="dd.MM.yyyy"
        locale="ru"
        />
    )
}

ReactDOM.render(<DateComponent name="date"/>, document.getElementById('root'));
arisha
  • 17
  • 6
  • What is ``? Where is this component defined? [Here](https://reactdatepicker.com/#example-custom-input) is an example. And it looks like your custom input component should use these props - `value`, and `onClick`. – Ajeet Shah Jan 25 '21 at 17:07
  • i am also faced this issue, have you got fixed? – Sathis Sakthivel Oct 14 '21 at 08:16
  • @Sathis Sakthivel sorry, didn't see your comment, I just used `MaskedInput ` from `react-text-mask` in customInput prop instead of ant design input and it worked – arisha Nov 23 '21 at 21:59

0 Answers0