I'm building a mobile (iOS/Android) website where I'd like to format times based on the device's 12/24 hour setting (On iOS in Settings > General > Date & Time). Is there any way to get the value of that setting in JavaScript?
The closest answer I found is that I can use Moment.js's LT
format which formats times as 12 or 24 hours based on the locale. But regardless of the locale set, they could override the 12/24 hour setting (at least on iOS), so I'd prefer to respect that setting.
Since this mobile website will be embedded in a webview in a native app one approach I'm considering is reading the value of that setting in native iOS/Android code and passing it into the website via a query string parameter, but was hoping to not have to update native code to solve this.