Add more dateTimePatters: relative+absolute time, date+timeInterval

Description

The datetime pattern (eg "{0} {1}") is intended for combining a date (eg "January 1") and a time (eg "5:01 PM") together. Some applications have been using this to combine a relative time (eg, "3 hours ago") and an absolute time (eg, "5:01 PM") together, which is not what the datetime pattern is intended for.

The intended result is something like "3 hours ago, 5:01 PM", but which may change according to language, eg the equivalent of "3 hours ago, at 17:01".

It would be useful to add that additional relativeAbsolutePattern.

GoogleIssue:185357244

Activity

Show:

Mark Davis May 4, 2022 at 9:04 PM

Excellent.

Peter Edberg May 4, 2022 at 8:56 PM

See also which is about date-time combining patterns for intervalFormats that combine a specific date with a time range, e.g. "January 19, 2022" and "08:30-10:00". In that case we would not want to use “{1} 'at' {0}” as we currently have in English. For that we were also going to add another set of 4 patterns. But that is likely similar to the relative-and-absolute pattern requested above, basically a pattern with separator but no grammatical joining context.

We need to have a single design that handles all of these. And note that the current default is actually the “event” style, with the grammatical context. I think that is wrong, the default should be without context.

Here is the structure that we currently have for English:

So here is what I propose, with the default data changing to the non-event style (time of day), and the “event” style moving to an alt variant; for medium and short there is no difference in English, so they fall back:

If we need more variants we can add them in the future. If this seems OK, I can take this ticket to do this, and then will resolve as a dup of this one.

Annemarie Apple 🍎 May 4, 2022 at 5:02 PM

Needs an example with hover preview

Mark Davis May 2, 2022 at 8:19 PM

How about:

<dateTimeFormats>

<relativeAndAbsolutePattern>{0}, {1}</…>

<dateTimeEventPattern>{0} at {1}</…>

Mark Davis June 23, 2021 at 4:51 AM

I think that would also be a useful addition.

Fixed

Details

Priority

Assignee

Reporter

Reviewer

Fix versions

Components

Labels

Phase

pre-sub

Created June 14, 2021 at 5:06 PM
Updated June 27, 2023 at 6:40 PM
Resolved May 9, 2022 at 3:48 PM