Skip to content

Commit

Permalink
Use KeyboardDatePicker for formik integration example
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Jul 19, 2019
1 parent 81da8e5 commit caea115
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/pages/guides/Formik.example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React from 'react';
import Code from '../../_shared/Code';
import { Grid } from '@material-ui/core';
import { Formik, Form, Field } from 'formik';
import { DatePicker } from '@material-ui/pickers';
import { KeyboardDatePicker } from '@material-ui/pickers';

const DatePickerField = ({ field, form, ...other }) => {
const currentError = form.errors[field.name];
return (
<DatePicker
<KeyboardDatePicker
clearable
disablePast
name={field.name}
Expand All @@ -16,7 +16,7 @@ const DatePickerField = ({ field, form, ...other }) => {
helperText={currentError}
error={Boolean(currentError)}
onError={(_, error) => form.setFieldError(field.name, error)}
onChange={date => form.setFieldValue(field.name, date, true)}
onChange={date => date && form.setFieldValue(field.name, date, true)}
{...other}
/>
);
Expand Down

0 comments on commit caea115

Please sign in to comment.