Closed Bug 598367 Opened 14 years ago Closed 7 years ago

Develop library functions to return nicely formatted date strings

Categories

(Core :: Internationalization, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Margaret, Assigned: smontagu)

References

Details

(Whiteboard: l20n?)

Using Date.toLocaleString() returns a date formatted in the OS locale, but sometimes the OS locale does not match the browser locale. We could use nsIScriptableDateFormat to format a date in the browser locale, but the formatting is inconsistent across platforms. For example, using timeFormatNone returns "10-09-21" on Linux but "Tuesday, September 21, 2010" on Windows. It would be nice if we had our own library that returned dates formatted in the browser locale with consistent formatting across platforms.
Please also add an additional method to this library to return in ISO 8601.
Why not just use the OS locale? That's what's used in (for example) the bookmarks window.
A library like this should include a format, which could fix bug 419220 - Dates in the download manager are partly OS locale partly browser locale, which makes them potentially unreadable.There is a long debate in bug 441167 about if dates should be displayed in OS locale or browser locale. The advantage of using OS locale is that it is what most other applications do, and users can customize the date display to their taste (including choosing ISO 8601 format). The advantage of using browser locale is that you can get more control of the date string by making it yourself instead of being restricted to the few possibilities supported by the OS, which may vary wildly between OSes. You could add date and time ranges, like the Lightning calendar does, or you could add dates shown with relation to the current time, like the download manager does.
Blocks: 419220
We should probably pack this into l20n.
Whiteboard: l20n?
Blocks: 600569
This is now fixed with ECMA402 Intl.DateTimeFormat! :)
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.