You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.1 KiB
33 lines
1.1 KiB
2 years ago
|
import React from 'react';
|
||
|
import { SmileOutlined } from '@ant-design/icons';
|
||
|
import { DatePicker, Space } from 'antd';
|
||
|
import type { Dayjs } from 'dayjs';
|
||
|
|
||
|
const smileIcon = <SmileOutlined />;
|
||
|
const { RangePicker } = DatePicker;
|
||
|
|
||
|
type DatePickerValue = Dayjs | null;
|
||
|
type RangePickerValue = [Dayjs | null, Dayjs | null] | null;
|
||
|
|
||
|
const onChange = (
|
||
|
date: DatePickerValue | RangePickerValue,
|
||
|
dateString: [string, string] | string,
|
||
|
) => {
|
||
|
console.log(date, dateString);
|
||
|
};
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<Space direction="vertical" size={12}>
|
||
|
<DatePicker suffixIcon={smileIcon} onChange={onChange} />
|
||
|
<DatePicker suffixIcon={smileIcon} onChange={onChange} picker="month" />
|
||
|
<RangePicker suffixIcon={smileIcon} onChange={onChange} />
|
||
|
<DatePicker suffixIcon={smileIcon} onChange={onChange} picker="week" />
|
||
|
<DatePicker suffixIcon="ab" onChange={onChange} />
|
||
|
<DatePicker suffixIcon="ab" onChange={onChange} picker="month" />
|
||
|
<RangePicker suffixIcon="ab" onChange={onChange} />
|
||
|
<DatePicker suffixIcon="ab" onChange={onChange} picker="week" />
|
||
|
</Space>
|
||
|
);
|
||
|
|
||
|
export default App;
|