import React from 'react';
import { DatePicker } from '@alicloud/console-components';
import moment, { Moment } from 'moment';

const startValue = moment('2017-11-20', 'YYYY-MM-DD', true);
const endValue = moment('2017-12-15', 'YYYY-MM-DD', true);

export default () => {
  const handleDateChange = (val: any[]) => {
    console.log(val.map((item: any) => (item as Moment).format('YYYY-MM-DD')));
  };

  return (
    <DatePicker.RangePicker
      defaultValue={[startValue, endValue]}
      // format='YYYY-MM-DD'
      onChange={handleDateChange}
    />
  );
}