i use a react-datepicker which i adjust to be compatible with redux form. My Datepicker component is like this:
const MyDatePicker = ({ input, meta: { touched, error } }) => (
<div>
<DatePicker
{...input} dateFormat="YYYY-MM-DD"
selected={input.value ? moment(input.value, 'YYYY-MM-DD') : null}
/>
{
touched && error &&
<span className="error">
{error}
</span>
}
</div>
);
By the way it does not show the validation messages when i trigger a validation.
When i enter a date in a date input like the screenshot above:
an error is shown multiple times (5789 to be more accurate). That has the impact of making my app slow when i use dates. I google it but i didn't find a proper solution. Do you have any idea how to handle this? The error is:
Uncaught Error: Error serializing unrecognized object Sun Mar 26 2017 00:00:00 GMT+0200
at b.rep (index.js:143)
at Object.com.cognitect.transit.impl.writer.marshal (transit.js:2912)
at Object.com.cognitect.transit.impl.writer.emitObjects (transit.js:2755)
at Object.com.cognitect.transit.impl.writer.emitArray (transit.js:2765)
at Object.com.cognitect.transit.impl.writer.marshal (transit.js:2930)
at Object.com.cognitect.transit.impl.writer.emitTaggedMap (transit.js:2892)
at Object.com.cognitect.transit.impl.writer.emitEncoded (transit.js:2909)
at Object.com.cognitect.transit.impl.writer.marshal (transit.js:2934)
at Object.com.cognitect.transit.impl.writer.emitObjects (transit.js:2755)
at Object.com.cognitect.transit.impl.writer.emitArray
Last but not least i use REDUX-FORM/IMMUTABLE
I am too getting same issue. My code look like.
<Container>
{label && <Label icon={icon}>{label}</Label>}
<DatePickerPure
onBlur={() => input.onBlur()}
// onChange={(val) => input.onChange(val ? val.toDate(val) : null)}
onChange={(val) => input.onChange(val ? moment(val) : null)}
selected={dateValue}
id={`field_${input.name}`}
placeholder={placeholder}
/>
<FieldError touched={touched} error={error} warning={warning} />
</Container>
In beginning date Filed was not picking correct date for the very 1st time. It was always picking 1 previous day. As soon as I use momnet(val), date field picking correct date but i m getting this error in my console. If any body can help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With