Render 12/24 hour format according to user's preference
Fixes: https://github.com/github/relative-time-element/issues/276
In my testing on MacOS, neither Chrome, Safari or Firefox did follow the OS's "24-hour time" setting, so from what I gather, browsers seem to try to determine this based on locale only currently.
Before (with 24h preference):
After (with 24h preference):
With user config override:
@silverwind I'm not entirely sure, but would it be possible to add some tests as well?
Yes, some tests should be possible and given that they run in Chromium they might actually return some useful results.
Maybe @keithamus also has some feedback.
Also, I'm certain now that Intl.Locale.prototype.getHourCycles is a flawed approach that will not work reliably because it obtains the hourCycle preference for a given locale which not necessarily matches what the user has configured. It fails in my case where I have en-US configured as OS locale but have 24h cycle set in the OS. In https://stackoverflow.com/questions/27647918, there are various workarounds being discussed and all of them basically rely on checking how dates as being formatted as string.
Yes, some tests should be possible and given that they run in Chromium they might actually return some useful results.
Sounds good! Assigning it back to you then :)
No obligation, of course! Let me know if you'd like one of us to pick up the tests instead