LXT
LXT

Reputation: 845

Format time of input type time

this is my input:

                <input
                  type="time"
                  className="start-time"
                  name="busi_start_time"
                  // value="Message"
                />

the screen will display as hh:mm (12h). How can I format it as HH:mm (24h)?

Upvotes: 0

Views: 5772

Answers (1)

Houssam
Houssam

Reputation: 1877

It is not possible to customize the display format of the HTML input time as you can see in the documentation:

[...] uses a 12- or 24-hour format for inputting times, based on system locale

The behavior of the HTML input is defined by the browser and it seems that all browsers use the OS locale format to choose which display format to show to the user. So seeing a 12h or 24h format will depend on which is set on your OS.

A potential solution to force a display format is to use a library, but I guess that is outside of the scope of your question.

Upvotes: 1

Related Questions