import React from 'react';
import { DatePicker } from 'antd';
import styles from './styles.less';
import { antiAssign } from '../../../../utils/utils';

export const ApolloDate = (props: any) => {
    const { onChange } = props;
    const selfProps = antiAssign(props, ['onChange', 'columnConfig']);
    const changeValue = (date, dateString) => {
        if (typeof onChange === 'function') {
            onChange(date, dateString);
        }
    };
    return (
        <DatePicker
            className={styles.date}
            dropdownClassName={styles.dropdownClassName}
            popupStyle={{ width: '350px' }}
            {...selfProps}
            onChange={changeValue}
        />
    );
};
