Configuring TimePicker in Ant Design to Display and Select Time in 'HH:mm' Format

88 Views Asked by At

How can I configure the TimePicker component in Ant Design to always display and select the time in the "HH:mm" format, regardless of whether the user enters the time in the formats "HH," "HHmm," or "HH:mm"?

Non remedium adhibere

1

There are 1 best solutions below

1
Jahidul On

In Antd TimePicker component, you can configure the format in which the time is displayed and selected by using the format prop

Here's an example of how you might achieve this in React:

<Form.Item
  name="name"
  label="Time"
>
  <TimePicker use12Hours format='HH:mm:ss'/>
</Form.Item>