import { DatePicker, } from 'antd';
import FormItem from '../FormItem/FormItem'
import React from 'react';
import 'moment/locale/zh-cn';
import { getItemProps } from "../../utils"
import schema from "./schema"
const { RangePicker } = DatePicker;

const DateTimeRangeWapper = (item: any) => {
  const data: any = getItemProps(schema, item)
  const { componentType, FormItemProps, ControlProps } = data
  const RangeBox = () => {
    return <RangePicker className='kx_antd_rangepicker' showTime {...ControlProps} />
  }
  return (
    <>
      {
        componentType === 'FormItem' ?
          <FormItem FormItemProps={...FormItemProps}  >
            {RangeBox()}
          </FormItem> : RangeBox()
      }
    </>
  );
};

export default DateTimeRangeWapper;
