import * as React from 'react';
import { injectIntl } from 'react-intl';
import DatePicker from '../../components/date-picker';
import { convertISOStringToUTCDate } from '../../utils/datetime';
import messages from './messages';
import './DateMetadataField.scss';
const DateMetadataField = ({
  dataKey,
  dataValue,
  displayName,
  description,
  intl,
  onChange,
  onRemove
}) => /*#__PURE__*/React.createElement(DatePicker, {
  className: "bdl-DateMetadataField",
  dateFormat: "utcISOString",
  description: description,
  displayFormat: {
    day: 'numeric',
    month: 'long',
    year: 'numeric'
  },
  hideOptionalLabel: true,
  label: displayName,
  onChange: (date, isoDate) => {
    if (isoDate) {
      onChange(dataKey, isoDate);
    } else {
      onRemove(dataKey);
    }
  },
  placeholder: intl.formatMessage(messages.metadataFieldSetDate),
  value: typeof dataValue === 'string' ? convertISOStringToUTCDate(dataValue) : undefined
});
export { DateMetadataField as DateMetadataFieldBase };
export default injectIntl(DateMetadataField);
//# sourceMappingURL=DateMetadataField.js.map