import React from 'react';
import { DatePicker } from 'antd';

function DDDateField(props) {
  const { format = "", disabled, onChange, placeholder } = props;

  const handleChange = (date) => {
    onChange?.(date.format('YYYY-MM-DD HH:mm:ss'));
  };
  return (
    <DatePicker
      placeholder={placeholder}
      disabled={disabled}
      format={format.replace('yyyy', 'YYYY').replace('dd', 'DD')}
      onChange={handleChange}
    />
  );
}

export default DDDateField;
