-
-
Notifications
You must be signed in to change notification settings - Fork 53.3k
Description
Reproduction link
Steps to reproduce
`import React, { useState } from 'react';
import './index.css';
import type { TimeRangePickerProps } from 'antd';
import { DatePicker, Space } from 'antd';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
const { RangePicker } = DatePicker;
const onRangeChange = (
dates: null | (Dayjs | null)[],
dateStrings: string[]
) => {
if (dates) {
console.log('From: ', dates[0], ', to: ', dates[1]);
console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
} else {
console.log('Clear');
}
};
const rangePresets: TimeRangePickerProps['presets'] = [
{ label: 'Last 7 Days', value: [dayjs().add(-7, 'd'), dayjs()] },
{ label: 'Last 14 Days', value: [dayjs().add(-14, 'd'), dayjs()] },
{ label: 'Last 30 Days', value: [dayjs().add(-30, 'd'), dayjs()] },
{ label: 'Last 90 Days', value: [dayjs().add(-90, 'd'), dayjs()] },
];
const App: React.FC = () => {
return (
);
};
export default App;`
What is expected?
点击预设值可以直接setValue并关闭面板
What is actually happening?
需要点击两次
Environment | Info |
---|---|
antd | 5.26.6 |
React | 18.2.0 |
System | windows 11 |
Browser | Chorme 120 |