1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Input } from 'antd';
import DatePickerCustom, { TimePickerCustom, RangePickerCustom } from '../index';
const Demo = (props) => {
const [startTime, setStartTime] = useState('');
const [endTime, setEndTime] = useState('');
const onChange = (date, dateString) => {
console.log(date);
setStartTime(date.startTime);
setEndTime(date.endTime);
};
return (
<>
<DatePickerCustom
onChange={onChange}
picker="date"
style={{ marginRight: '10px', marginBottom: '10px' }}
/>
<DatePickerCustom
onChange={onChange}
picker="week"
style={{ marginRight: '10px', marginBottom: '10px' }}
/>
<DatePickerCustom
onChange={onChange}
picker="month"
style={{ marginRight: '10px', marginBottom: '10px' }}
/>
<DatePickerCustom
onChange={onChange}
picker="quarter"
style={{ marginRight: '10px', marginBottom: '10px' }}
/>
<DatePickerCustom
onChange={onChange}
picker="year"
style={{ marginRight: '10px', marginBottom: '10px' }}
/>
<div style={{ display: 'flex' }}>
<Input
value={startTime}
placeholder="起始时间"
style={{ marginRight: '10px', width: '250px' }}
/>
<Input
value={endTime}
placeholder="结束时间"
style={{ marginRight: '10px', width: '250px' }}
/>
</div>
</>
);
};
export default Demo;