I want browsers to respect my system’s preferred date/time format
Submitted by Nikhil Mehta
Permalink https://webwewant.fyi/wants/8651089d-f57a-4467-985b-57abe108729c/
This idea is currently being discussed.
I want browsers to respect the date and time format I have configured in my operating system so that web apps display dates and times consistently with my system preferences.
Right now, I keep all my apps — calendar apps, scheduling tools, and system clocks — configured to display time in a consistent format. But when I visit web apps like Google Calendar, Outlook, or Calendly, they ignore my system preferences and show dates and times in whatever format they choose, forcing me to mentally convert between formats.
The Intl.DateTimeFormat API already lets developers specify a locale and formatting style, but there is no way to tell it "use whatever the user's operating system is configured to use." Adding a "system" keyword (or equivalent) to the timeStyle and dateStyle options would solve this. The browser could then read the OS-level preference and apply it automatically.
For example, if I have my system configured to use 12-hour time, the following should produce output respecting that preference:
const date = new Date(Date.UTC(2020, 11, 20, 3, 23, 16, 738));
// Option A: a dedicated timeStyle value
const formatter = new Intl.DateTimeFormat('en-GB', {
dateStyle: 'medium',
timeStyle: 'system' // uses OS-level time format preference
});
formatter.format(date);
// 12-hour OS preference: "20 Dec 2020, 8:53 AM"
// 24-hour OS preference: "20 Dec 2020, 08:53"
// Option B: a separate flag alongside existing style options
const formatter2 = new Intl.DateTimeFormat('en-GB', {
dateStyle: 'medium',
timeStyle: 'short',
useSystemTimePreference: true // override timeStyle length with OS preference
});- Votes
- 0
What are votes for and how are they tallied?