Skip to content

Add hour12 date/time override option #948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions spec/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,10 @@ All other _operand_ values produce a _Bad Operand_ error.
The `:datetime` function can use either the appropriate _style options_
or can use a collection of _field options_ (but not both) to control the formatted
output.
_Date/time override options_ can be combined with either _style options_ or _field options_.

If both are specified, a _Bad Option_ error MUST be emitted
If both _style options_ and _field options_ are specified,
a _Bad Option_ error is emitted
and a _fallback value_ used as the _resolved value_ of the _expression_.

If the _operand_ of the _expression_ is an implementation-defined date/time type,
Expand Down Expand Up @@ -897,7 +899,7 @@ and what format to use for that field.
The _field options_ are defined as follows:

> [!IMPORTANT]
> The value `2-digit` for some _field options_ **must** be quoted
> The value `2-digit` for some _field options_ MUST be quoted
> in the MessageFormat syntax because it starts with a digit
> but does not match the `number-literal` production in the ABNF.
> ```
Expand Down Expand Up @@ -939,11 +941,6 @@ The function `:datetime` has the following options:
- `1`
- `2`
- `3`
- `hourCycle` (default is locale-specific)
- `h11`
- `h12`
- `h23`
- `h24`
- `timeZoneName`
- `long`
- `short`
Expand Down Expand Up @@ -995,6 +992,7 @@ The function `:date` has these _options_:
- `long`
- `medium` (default)
- `short`
- _Date/time override options_
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line.
The overrides right now only support hour12, which is not valid on dates.


If the _operand_ of the _expression_ is an implementation-defined date/time type,
it can include other option values.
Expand Down Expand Up @@ -1032,6 +1030,7 @@ The function `:time` has these _options_:
- `long`
- `medium`
- `short` (default)
- _Date/time override options_

If the _operand_ of the _expression_ is an implementation-defined date/time type,
it can include other option values.
Expand Down Expand Up @@ -1095,3 +1094,21 @@ For more information, see [Working with Timezones](https://w3c.github.io/timezon
> The form of these serializations is known and is a de facto standard.
> Support for these extensions is expected to be required in the post-tech preview.
> See: https://datatracker.ietf.org/doc/draft-ietf-sedate-datetime-extended/

### Date and Time Override Options

**_<dfn>Date/time override options</dfn>_** are _options_ that allow an _expression_ to
override values set by the current locale,
or provided by the _formatting context_ (such as the default time zone),
or embedded in an implementation-defined date/time _operand_ value.

The following REQUIRED option and its values MUST be available on
the functions `:datetime` and `:time`:

- `hour12`
- `true`
- `false`

> [!NOTE]
> These options do not have default values because they are only to be used
> as overrides for locale-and-value dependent implementation-defined defaults.