ant-design Time RangePicker do not accept a start value greater than the end value

mwngjboj  于 22天前  发布在  其他
关注(0)|答案(1)|浏览(21)

Steps to reproduce

  1. Setup a DatePicker.RangePicker component with the props picker="time"
  2. Try setting a greater start time value than the end time value on the rendered UI (Ex: Start time = 07:00, End time = 01:00)

What is expected?

User should be able to set a range with a greater start time value than the end time value

What is actually happening?

When setting a start time value that is greater than the end time value, it swaps them automatically
| Environment | Info |
| ------------ | ------------ |
| antd | 5.9.0 |
| React | 17.0.2 |
| System | MacOS Sonoma 14.0 |
| Browser | Arc 1.32.0 Chromium 122.0.6261.94 |

Maybe you could add a props that when set to true allows users to set a range with a greater start time than the end time

7cwmlq89

7cwmlq891#

I've looked into rc-picker, and it appears there's an option which controls whether the date swap occurs or not. It's called "order" and it is found at the bottom of the RangePicker section in the documentation.
However, the option appears not to be supported by the Ant Design component per se.
Even though the option is not in the Ant Design documentation, it seems to work. Setting order={false} disables time re-ordering:

<DatePicker.RangePicker picker="time" format="HH:mm" order={false} />

Could we have this option added to the Ant Design documentation?

相关问题