import _extends from "@babel/runtime-corejs3/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
// @flow
import React from 'react';
import { DatePicker } from '@material-ui/pickers';
import { parseDateString, getDateString } from '../utils/helpers';

const DateField = (_ref) => {
  let {
    value,
    onChange
  }
  /*: any*/
  = _ref,
      otherProps = _objectWithoutPropertiesLoose(_ref, ["value", "onChange"]);

  const valueAsDate = parseDateString(value);
  return /*#__PURE__*/React.createElement(DatePicker, _extends({
    fullWidth: true,
    variant: "inline",
    inputVariant: "outlined",
    margin: "normal",
    format: "dd/MM/yyyy",
    autoOk: true,
    value: valueAsDate,
    onChange: date => onChange(getDateString(date))
  }, otherProps));
};

export default DateField;
//# sourceMappingURL=DateField.js.map