Skip to content

Commit

Permalink
Merge pull request #432 from glific/collection-date-fixes
Browse files Browse the repository at this point in the history
collection date fixes
  • Loading branch information
DigneshGujarathi authored Sep 4, 2020
2 parents ed56024 + b3330e0 commit 28a8e2f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/components/UI/Form/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Grid from '@material-ui/core/Grid';
import DateFnsUtils from '@date-io/date-fns';
import { MuiPickersUtilsProvider, KeyboardDatePicker } from '@material-ui/pickers';
import { getIn } from 'formik';
import moment from 'moment';

export interface CalendarProps {
variant?: any;
Expand All @@ -27,9 +26,7 @@ export const Calendar: React.SFC<CalendarProps> = ({
const errorText = getIn(errors, field.name);
const touchedVal = getIn(touched, field.name);
const hasError = dirty && touchedVal && errorText !== undefined;
moment.defaultFormat = 'yyyy-MM-dd';
const dateValue = field.value ? moment(field.value, moment.defaultFormat).toDate() : null;
// const defaultDateValue = field.value ? field.value : setFieldValue(field.name, '');
const dateValue = field.value ? field.value : null;

const handleDateChange = (date: Date | null | string) => {
if (date) {
Expand Down

0 comments on commit 28a8e2f

Please sign in to comment.