A generic, flexible time formatter

Registered by Michał Sawicz on 2013-12-10

We need a common, flexible time formatter that's to be used by applications, to display times in the user-selected locale, as opposed to arbitrary time formats fitting the application.

The app developer should only set the component in a minimal manner to get to the required appearance, but it should be abstracted away from locales and format strings, so that the user always get their time strings in a format they can understand.

12 vs. 24-hour selection should be overridable regardless of locale. There should be defined rules to create human-readable date-time strngs, with configurable level of accuracy (i.e. "yesterday" vs. "yesterday, 12:00am").

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Michał Sawicz
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Whiteboard

Some use cases

Durations:
- Hours:minutes remaining for batteries etc in the battery menu, e.g. "4:51"
- Days in the Backup panel of System Settings, e.g. "264 days ago"

Datestamps:
- Date as the first item in the clock menu, e.g. "Monday 6 January 2014"

Timestamps:
- Events and locations in the clock menu, including weekdays and dates if appropriate <https://wiki.ubuntu.com/TimeAndDate#menu-times>

Timestamps displayed differently depending on the available space, e.g. "9:38 PM", "Yesterday 5:51 PM", "2013-12-24 10:02 AM":
- times for e-mail messages in a mailbox
- modification times for files in a file manager (same as above)
- date/time that you last connected to a wi-fi network

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.