Skip to content

Commit ca22a2c

Browse files
committed
Define function composition for date/time values
1 parent cd4754d commit ca22a2c

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

spec/registry.md

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,11 @@ output.
796796
If both are specified, a _Bad Option_ error MUST be emitted
797797
and a _fallback value_ used as the resolved value of the _expression_.
798798
799+
If the _operand_ of the _expression_ is an implementation-defined date/time type,
800+
it can include _style options_, _field options_, or other option values.
801+
These are included in the resolved option values of the _expression_,
802+
with _options_ on the _expression_ taking priority over any option values of the _operand_.
803+
799804
> [!NOTE]
800805
> The names of _options_ and their _values_ were derived from the
801806
> [options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#description)
@@ -897,7 +902,15 @@ are encouraged to track development of these options during Tech Preview:
897902
- valid [Unicode Number System Identifier](https://cldr-smoke.unicode.org/spec/main/ldml/tr35.html#UnicodeNumberSystemIdentifier)
898903
- `timeZone` (default is system default time zone or UTC)
899904
- valid identifier per [BCP175](https://www.rfc-editor.org/rfc/rfc6557)
900-
905+
906+
#### Composition
907+
908+
When an _operand_ or an _option_ value uses a _variable_ with a _declaration_
909+
using an _expression_ with a `:datetime` _annotation_,
910+
its resolved value contains only the implementation-defined datetime value
911+
of the _operand_ of the annotated _expression_,
912+
together with the resolved options values.
913+
901914
### The `:date` function
902915
903916
The function `:date` is used to format the date portion of date/time values.
@@ -921,6 +934,19 @@ The function `:date` has these _options_:
921934
- `medium`
922935
- `short` (default)
923936
937+
If the _operand_ of the _expression_ is an implementation-defined date/time type,
938+
it can include other option values.
939+
Any _operand_ option values matching the `:datetime` _style options_ or _field options_ are ignored,
940+
as is any `style` option.
941+
942+
#### Composition
943+
944+
When an _operand_ or an _option_ value uses a _variable_ with a _declaration_
945+
using an _expression_ with a `:date` _annotation_,
946+
its resolved value contains only the implementation-defined date/time value
947+
of the _operand_ of the annotated _expression_ (with no time value),
948+
together with the resolved options values.
949+
924950
### The `:time` function
925951
926952
The function `:time` is used to format the time portion of date/time values.
@@ -944,6 +970,21 @@ The function `:time` has these _options_:
944970
- `medium`
945971
- `short` (default)
946972
973+
If the _operand_ of the _expression_ is an implementation-defined date/time type,
974+
it can include other option values.
975+
Any _operand_ option values matching the `:datetime` _style options_ or _field options_ are ignored,
976+
as is any `style` option.
977+
978+
#### Composition
979+
980+
When an _operand_ or an _option_ value uses a _variable_ with a _declaration_
981+
using an _expression_ with a `:time` _annotation_,
982+
its resolved value contains only the implementation-defined date/time value
983+
of the _operand_ of the annotated _expression_ (with no date value),
984+
together with the resolved options values.
985+
986+
Using a `:time` annotated value as the _operand_ of `:datetime` or `:date`
987+
produces a _Bad Operand_ error as it contains no date value.
947988
948989
### Date and Time Operands
949990
@@ -993,5 +1034,3 @@ For more information, see [Working with Timezones](https://w3c.github.io/timezon
9931034
> The form of these serializations is known and is a de facto standard.
9941035
> Support for these extensions is expected to be required in the post-tech preview.
9951036
> See: https://datatracker.ietf.org/doc/draft-ietf-sedate-datetime-extended/
996-
997-

0 commit comments

Comments
 (0)