I am using Antd RangePicker for showing date range with Time.
By default, the time is the 24hr format. I need to show time in 12hr format. How can I set time in 12-hour format?
<RangePicker
disabledDate={this.disabledDate}
showTime={{
format: 'HH:mm',
hideDisabledOptions: true,
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('11:59:59',
'HH:mm:ss')],
}}
format="YYYY-MM-DD HH:mm:ss"
/>
I have tried options like:
use12Hours = {true}
But nothing worked for me. Please help.
Ant Design uses momentjs
and so you should be able to use the format: 'hh:mm'
you may want to add an A, as in format: 'hh:mm A'
in order to display the AM/PM time to ensure you do not confuse the person reading the time.
In addition to this you have FORMAT specified twice in your config.
You can read more about displaying times in momentjs here:
http://momentjs.com/docs/#/displaying/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With