htmlgoogle-chrometimesafarigoogle-nexus

Nexus tablet adding AM/PM to HTML5 time fields


I'm developing a web app which uses HTML5 time fields that is intended for use on both desktop and tablets. The time fields work fine for both Chrome and Safari on desktop, displaying '--:--' as a default value with arrows to increase/decrease time as I'd expect.

The issue is when testing it on a Nexus tablet it seems to add an AM/PM option which defaults to 'AM' that isn't present at all on the desktop versions. My issue is sometimes these time fields aren't used strictly for inputting a time but also sometimes for measuring the duration of something, where an AM/PM option simply wouldn't make sense.

I've tried Googling for a solution to this problem but I have not been able to find very much information regarding it. Does anyone know why this occurs and how I can turn it off? Is it a system setting on the Nexus or is there an attribute I can add to the time tags to prevent it?


Solution

  • Well I seem to have found the issue myself - the system's language setting was 'English (United States)' which seems to overwrite setting time to a 24-hour format. By changing the language setting to 'English (United Kingdom)' it now obeys the 24-hour format and AM/PM no longer shows in the time fields.

    It's pretty annoying that a system setting has to be changed for this rather than being able to do it on a site-by-site basis, but fortunately for this project I do have control over system settings by and large so it has solved the issue for me.