Skip to content

Ensure components::Bag will always generate a result #586

@gregtatum

Description

@gregtatum

I'm modifying this big to be a bit more subtle, which is to ensure that every components::Bag returns a result. The appendItems support is one way of doing that, but currently the components bag may not return a result. This wouldn't be compatible with ECMA-402, so we should have a solution for it. This may be appendItems, or something else.


Original discussion:

https://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons

In case the best match does not include all the requested calendar fields, the appendItems element describes how to append needed fields to one of the existing formats. Each appendItem element covers a single calendar field. In the pattern, {0} represents the format string, {1} the data content of the field, and {2} the display name of the field (see Calendar Fields).

For the skeleton matching code, there is an appendItems list. It is used to add items to the matching patterns. This is the only way to add time zones to the patterns. However, there was some debate on the quality of results from using the appendItems list. In the 2020-02-05 ICU4X meeting, it was determined to not use this appendItems list. However, we clearly need it for time zones.

I'm labeling this issue as discussion, as we have some outstanding issues to figure out:

  • Which appendItems must we support? Time zones are the minimum as of now.
  • Which appendItems should we not support.
  • What happens with Skeleton missing fields?
    • Right now we are actively not planning on supporting appendItems, as it can generate really bad localizations.
    • In the ICU4C implementation, the skeleton matching attempts a few smart heuristics like adding the minutes field if only hour and seconds are in the skeleton. Should we determine and document if we will fill in "holes" in the components::Bag like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-datetimeComponent: datetime, calendars, time zonesS-mediumSize: Less than a week (larger bug fix or enhancement)T-coreType: Required functionalityhelp wantedIssue needs an assignee

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions