javascript - In different browsers input time field shows in different formats -
i have created input time html element, line:
<input type="time" id="starttime" value="@datetime.now.tostring("hh:mm")" />
i using c# razor
syntax, not matter.
i checked in both google chrome , mozilla
firefox , in both time represented in 24 hour format. later, when shared code colleagues, in versions of chrome
time represented in 12-hour format , pm. there way specify in html
code time should represented in 1 way in browsers.
there similar question here, asked 3 years ago , accepted answer starts with:
this feature still in draft. each browser shows differently.
so wondering if issue has been resolved in meantime. if not, suggestions of time components welcome. simplest way comes mind use separate select tags, prefer use single component wraps both hours , minutes.
edit: realized problem local settings of machine browser runs on, , after changing settings on colleagues' laptops works fine. wondering if there way force browsers show time in same format, no matter of machine's settings. use fields in several places, preferably stick them , not using different html components (because don't want make many changes in code). problem noticed input time field not drop-down list in mozilla (and in chrome drop-down like).
shortly, question be: how can use input time fields
, force them show time in same format in browsers, no matter on time settings of machine running on.
thank you!
it not related browser, system settings.
input type="time"
displays time depending on regional settings defined on system.
the same applies dates.
how can use input time fields , force them show time in same format in browsers, no matter on time settings
there plenty of different solutions. used input type="text"
. there jquery plugins can handle that. js library widly used moment.js
Comments
Post a Comment