0

So I am using default time picker of HTML

<input type="time" />

Now my problem is in some system it is coming as 12HR format and in some system as 24HR format.

Is there any solution for this so that I can fix this as 12HR format?

Paulie_D
  • 107,962
  • 13
  • 142
  • 161
Harshit verma
  • 506
  • 3
  • 25
  • If the user is more comfortable using 24 hours, why would you want to change that? The `value` is always in 24 hour format regardless of what is displayed to the user. – D. Pardal Jun 01 '20 at 11:45
  • It's a request from the client to fix it as 12 HR – Harshit verma Jun 01 '20 at 11:46
  • 2
    Well, sorry, but that requires some custom time picker. The format presented to the user in the native time inputs is an OS preference. I wouldn't suggest going against it, because some users may get confused while using other format. Do you have any idea about why the client would want that? http://xyproblem.info/ – D. Pardal Jun 01 '20 at 11:50
  • What is displayed doesn't matter. The browser will always send it in 24-hour format. – Niet the Dark Absol Jun 01 '20 at 11:54
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time I think the only solution is to create a custom time picker as @D.Pardal mentioned. – Nicolae Maties Jun 01 '20 at 11:54
  • @NiettheDarkAbsol Yes I know that, but what is shown that does matter also – Harshit verma Jun 01 '20 at 12:12
  • I found out that whatever format is chosen in the system time input type="time" takes that only, it cannot be further customized – Harshit verma Jun 01 '20 at 12:13
  • @D.Pardal Actually the user of that software are more comfortable with the 12 hr format – Harshit verma Jun 01 '20 at 12:14
  • @harshitverma Then tell the user to change its OS's settings. It's easier that way. – D. Pardal Jun 01 '20 at 12:46

0 Answers0