ant-design TimePicker to support multiple input formats

8fsztsew  于 2022-11-19  发布在  其他
关注(0)|答案(2)|浏览(161)
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

When a user enters a time they are currently forced to match a single input format which may not match the time format displayed from the selector. This feature request is to make the time picker control more user friendly by making it support a list of accepted time formats.

A example use case for this feature, is a user could enter the input as h:mm a or HH:MM . Both of these inputs can be parsed to a valid time and are accepted by the input, the value is then displayed as the first format ( h:mm a ) regardless of the value entered.

What does the proposed API look like?

<TimePicker format={['hh:mm a', 'HH:mm']} ... />

When an array is provided, the first value is used for rendering the time while all values are accepted for parsing the input value.
moment already supports parsing a time given an array of formats

35g0bw71

35g0bw711#

@issuehuntfest has funded $20.00 to this issue. See it on IssueHunt

waxmsbnn

waxmsbnn2#

Why this helpful feature has not yet taken into use, although the implementation for this has been done for a long time ago?

相关问题