From 6a829f5e1b528f5fe2fc8f7ca8cb6bbaa9c313a4 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Wed, 14 Feb 2024 13:04:20 -0800 Subject: [PATCH 1/9] Implement changes to date/time functions This is per the 2024-02-14 teleconference. --- .../default-registry-and-mf1-compatibility.md | 51 ++++++++++++++----- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/exploration/default-registry-and-mf1-compatibility.md b/exploration/default-registry-and-mf1-compatibility.md index 4bd65592b2..b1d4826481 100644 --- a/exploration/default-registry-and-mf1-compatibility.md +++ b/exploration/default-registry-and-mf1-compatibility.md @@ -33,6 +33,9 @@ Therefore, addition to this list requires a higher level of rigor. ### Numbers +> [!IMPORTANT] +> This section is replaced by the design for number selection + Function name: `:number` Aliases: @@ -86,6 +89,11 @@ If no options are specified, each of the functions defaults to the following: > Pattern selection based on date/time values is a complex topic and no support for this > is required in this release. +> [!NOTE] +> The default formatting behavior of `:datetime` is inconsistent with `Intl.DateTimeFormat` +> in JavaScript and with `{d,date}` in MessageFormat v1. +> This is because, unlike those implementations, `:datetime` is distinct from `:date` and `:time`. + #### Operands The _operand_ of a date/time function is either @@ -133,20 +141,14 @@ For more information, see [Working with Timezones](https://w3c.github.io/timezon #### Options -All date/time functions support the following options, which -provide high-level control over date/time formats: -- `calendar` (default is locale-specific) - - valid [Unicode Calendar Identifier](https://cldr-smoke.unicode.org/spec/main/ldml/tr35.html#UnicodeCalendarIdentifier) -- `numberingSystem` (default is locale-specific) - - valid [Unicode Number System Identifier](https://cldr-smoke.unicode.org/spec/main/ldml/tr35.html#UnicodeNumberSystemIdentifier) -- `timeZone` (default is system default time zone or UTC) - - valid identifier per [BCP175](https://www.rfc-editor.org/rfc/rfc6557) - -In addition to the above high-level options, a function can use either the appropriate -_style_ options for that function +A function can use either the appropriate _style_ options for that function or can use a collection of _field options_ (but not both) to control the formatted output. +If both are specified, the _style_ option takes precedence. + +##### Style Options + The function `:datetime` has these function-specific _style_ options. - `dateStyle` - `full` @@ -173,6 +175,12 @@ The function `:time` has these function-specific _style_ options: - `medium` - `short` +##### Field Options + +Field options describe which fields to include in the formatted output +and what format to use for that field. +Only those fields specified in the _annotation_ appear in the formatted output. + The _field_ options are defined as follows: All functions have the following option: @@ -184,7 +192,7 @@ All functions have the following option: - `shortGeneric` - `longGeneric` -The functions `:datetime` and `:date` have the following options: +The function `:datetime` has the following options: - `weekday` - `long` - `short` @@ -205,8 +213,6 @@ The functions `:datetime` and `:date` have the following options: - `day` - `numeric` - `2-digit` - -The functions `:datetime` and `:time` have the following options: - `hour` - `numeric` - `2-digit` @@ -226,6 +232,23 @@ The functions `:datetime` and `:time` have the following options: - `h23` - `h24` +The function `:time` has following option, whose purpose is to override the default hour cycle: +- `hourCycle` (default is locale-specific) + - `h11` + - `h12` + - `h23` + - `h24` + +The followind date/time options are *not* part of the default registry. +Implementations SHOULD avoid creating options that conflict with these, but +are encouraged to track development of these options during Tech Preview: +- `calendar` (default is locale-specific) + - valid [Unicode Calendar Identifier](https://cldr-smoke.unicode.org/spec/main/ldml/tr35.html#UnicodeCalendarIdentifier) +- `numberingSystem` (default is locale-specific) + - valid [Unicode Number System Identifier](https://cldr-smoke.unicode.org/spec/main/ldml/tr35.html#UnicodeNumberSystemIdentifier) +- `timeZone` (default is system default time zone or UTC) + - valid identifier per [BCP175](https://www.rfc-editor.org/rfc/rfc6557) + #### Selection From 2d04a8f3fe5c73af6b78b9a446df82cb0348e9fc Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Wed, 14 Feb 2024 20:16:31 -0800 Subject: [PATCH 2/9] Move `timezoneName` out of `:date`; clarify defaults or lack thereof Consistent with `:number` doc --- .../default-registry-and-mf1-compatibility.md | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/exploration/default-registry-and-mf1-compatibility.md b/exploration/default-registry-and-mf1-compatibility.md index b1d4826481..7475251227 100644 --- a/exploration/default-registry-and-mf1-compatibility.md +++ b/exploration/default-registry-and-mf1-compatibility.md @@ -154,26 +154,26 @@ The function `:datetime` has these function-specific _style_ options. - `full` - `long` - `medium` - - `short` + - `short` (default) - `timeStyle` - `full` - `long` - `medium` - - `short` + - `short` (default) The function `:date` has these function-specific _style_ options: - `style` - `full` - `long` - `medium` - - `short` + - `short` (default) The function `:time` has these function-specific _style_ options: - `style` - `full` - `long` - `medium` - - `short` + - `short` (default) ##### Field Options @@ -181,16 +181,14 @@ Field options describe which fields to include in the formatted output and what format to use for that field. Only those fields specified in the _annotation_ appear in the formatted output. +> [!NOTE] +> Field options do not have default values because they are only to be used +> to compose the formatter. +> Each value must be specified. + The _field_ options are defined as follows: All functions have the following option: -- `timeZoneName` - - `long` - - `short` - - `shortOffset` - - `longOffset` - - `shortGeneric` - - `longGeneric` The function `:datetime` has the following options: - `weekday` @@ -231,14 +229,32 @@ The function `:datetime` has the following options: - `h12` - `h23` - `h24` +- `timeZoneName` + - `long` + - `short` + - `shortOffset` + - `longOffset` + - `shortGeneric` + - `longGeneric` + +> [!NOTE] +> The following options do not have default values because they are only to be used +> as overrides for locale-and-value dependent implementation-defined defaults. -The function `:time` has following option, whose purpose is to override the default hour cycle: +The function `:time` has following additional options: - `hourCycle` (default is locale-specific) - `h11` - `h12` - `h23` - `h24` - +- `timeZoneName` + - `long` + - `short` + - `shortOffset` + - `longOffset` + - `shortGeneric` + - `longGeneric` + The followind date/time options are *not* part of the default registry. Implementations SHOULD avoid creating options that conflict with these, but are encouraged to track development of these options during Tech Preview: From 74474e272f37845b3ed2a38cc4f38b590339d42c Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Wed, 14 Feb 2024 20:20:35 -0800 Subject: [PATCH 3/9] change error to Operand Mismatch Error --- exploration/default-registry-and-mf1-compatibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exploration/default-registry-and-mf1-compatibility.md b/exploration/default-registry-and-mf1-compatibility.md index 7475251227..f8a0fe0145 100644 --- a/exploration/default-registry-and-mf1-compatibility.md +++ b/exploration/default-registry-and-mf1-compatibility.md @@ -117,7 +117,7 @@ For more information, see [Working with Timezones](https://w3c.github.io/timezon > The [ABNF](/spec/message.abnf) and [syntax](/spec/syntax.md) of MFv2 > do not formally define date/time literals. > This means that a _message_ can be syntactically valid but produce -> runtime errors due to what amounts to a "type mismatch". +> an _Operand Mismatch Error_ at runtime. > [!NOTE] > String values passed as variables in the _formatting context_'s From fc14878e4180f4d996d170e189dee046fd730e8a Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Wed, 14 Feb 2024 21:36:15 -0800 Subject: [PATCH 4/9] Update exploration/default-registry-and-mf1-compatibility.md Co-authored-by: Shane F. Carr --- exploration/default-registry-and-mf1-compatibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exploration/default-registry-and-mf1-compatibility.md b/exploration/default-registry-and-mf1-compatibility.md index f8a0fe0145..4f9d2b1c5b 100644 --- a/exploration/default-registry-and-mf1-compatibility.md +++ b/exploration/default-registry-and-mf1-compatibility.md @@ -241,7 +241,7 @@ The function `:datetime` has the following options: > The following options do not have default values because they are only to be used > as overrides for locale-and-value dependent implementation-defined defaults. -The function `:time` has following additional options: +The function `:time` has following options: - `hourCycle` (default is locale-specific) - `h11` - `h12` From 9bf73c73e85c64e4238e8befdc36ff453cfaa97b Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Thu, 15 Feb 2024 06:40:17 -0800 Subject: [PATCH 5/9] Update exploration/default-registry-and-mf1-compatibility.md Co-authored-by: Eemeli Aro --- exploration/default-registry-and-mf1-compatibility.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exploration/default-registry-and-mf1-compatibility.md b/exploration/default-registry-and-mf1-compatibility.md index 4f9d2b1c5b..0766928a39 100644 --- a/exploration/default-registry-and-mf1-compatibility.md +++ b/exploration/default-registry-and-mf1-compatibility.md @@ -145,7 +145,8 @@ A function can use either the appropriate _style_ options for that function or can use a collection of _field options_ (but not both) to control the formatted output. -If both are specified, the _style_ option takes precedence. +If both are specified, an _Invalid Expression_ error MUST be emitted +and a _fallback value_ used as the resolved value of the _expression_. ##### Style Options From 7b3c4bc82c46418723114f3a888619a396f436ef Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Thu, 15 Feb 2024 06:43:27 -0800 Subject: [PATCH 6/9] Apply suggestions from code review Co-authored-by: Eemeli Aro --- exploration/default-registry-and-mf1-compatibility.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exploration/default-registry-and-mf1-compatibility.md b/exploration/default-registry-and-mf1-compatibility.md index 0766928a39..3d45130c84 100644 --- a/exploration/default-registry-and-mf1-compatibility.md +++ b/exploration/default-registry-and-mf1-compatibility.md @@ -155,12 +155,12 @@ The function `:datetime` has these function-specific _style_ options. - `full` - `long` - `medium` - - `short` (default) + - `short` - `timeStyle` - `full` - `long` - `medium` - - `short` (default) + - `short` The function `:date` has these function-specific _style_ options: - `style` From 03b2548b9770e59ed186dacd421be73e3b75aba8 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Thu, 15 Feb 2024 06:50:26 -0800 Subject: [PATCH 7/9] Update exploration/default-registry-and-mf1-compatibility.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stanisław Małolepszy --- exploration/default-registry-and-mf1-compatibility.md | 1 - 1 file changed, 1 deletion(-) diff --git a/exploration/default-registry-and-mf1-compatibility.md b/exploration/default-registry-and-mf1-compatibility.md index 3d45130c84..415e498ffd 100644 --- a/exploration/default-registry-and-mf1-compatibility.md +++ b/exploration/default-registry-and-mf1-compatibility.md @@ -185,7 +185,6 @@ Only those fields specified in the _annotation_ appear in the formatted output. > [!NOTE] > Field options do not have default values because they are only to be used > to compose the formatter. -> Each value must be specified. The _field_ options are defined as follows: From 9f158d98c9a58f2c5edfe4fc09cc75af22445103 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Thu, 15 Feb 2024 08:15:46 -0800 Subject: [PATCH 8/9] Update exploration/default-registry-and-mf1-compatibility.md Co-authored-by: Eemeli Aro --- exploration/default-registry-and-mf1-compatibility.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/exploration/default-registry-and-mf1-compatibility.md b/exploration/default-registry-and-mf1-compatibility.md index 415e498ffd..e4c487d21d 100644 --- a/exploration/default-registry-and-mf1-compatibility.md +++ b/exploration/default-registry-and-mf1-compatibility.md @@ -188,8 +188,6 @@ Only those fields specified in the _annotation_ appear in the formatted output. The _field_ options are defined as follows: -All functions have the following option: - The function `:datetime` has the following options: - `weekday` - `long` From 308dd1d36edd2dbbee46b1979799cd1d0d7bae24 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Thu, 15 Feb 2024 09:28:08 -0800 Subject: [PATCH 9/9] Update exploration/default-registry-and-mf1-compatibility.md Co-authored-by: Eemeli Aro --- .../default-registry-and-mf1-compatibility.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/exploration/default-registry-and-mf1-compatibility.md b/exploration/default-registry-and-mf1-compatibility.md index e4c487d21d..b8896d4dab 100644 --- a/exploration/default-registry-and-mf1-compatibility.md +++ b/exploration/default-registry-and-mf1-compatibility.md @@ -239,20 +239,6 @@ The function `:datetime` has the following options: > The following options do not have default values because they are only to be used > as overrides for locale-and-value dependent implementation-defined defaults. -The function `:time` has following options: -- `hourCycle` (default is locale-specific) - - `h11` - - `h12` - - `h23` - - `h24` -- `timeZoneName` - - `long` - - `short` - - `shortOffset` - - `longOffset` - - `shortGeneric` - - `longGeneric` - The followind date/time options are *not* part of the default registry. Implementations SHOULD avoid creating options that conflict with these, but are encouraged to track development of these options during Tech Preview: