-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
[FEEDBACK] Don't include a time zone option, or be strict if you do #961
Comments
(as individual contributor) Omitting support for time zones is super unhelpful for users, who will want to format date and time values and who have needs for managing the time zone used (or not used, in the case of floated or "plain" values) and who do not always have control over the format of the incoming value. A ZonedDateTime is a moment attached to the timeline. It is a clearly identified moment in time with no ambiguity. It can be formatted for display, and users will want to pass it for formatting. Otherwise, what is the point? A user can have a ZonedDateTime and wish to use a different time zone for displaying the value. Or they might have done as you seem to be suggesting and have an Instant--in which case they had better have a The Note that the Is there some danger that users will do Bad Things using (as chair) Please note that this option is PROPOSED for 2.0 and is still open to change. Please file normal issues or (better yet) submit a design document for what we should do. |
ICU4X formats datetimes without access to full TZDB. This is possible so long as the datetime is annotated with an offset from elsewhere in the stack. For example, the server can calculate the offset from TZDB and send an annotated IXDTF string to a client running ICU4X that does not need TZDB to format it. |
|
@sffc notes:
There are a number of problems here. One is: MF2 does not have types. We can specify that implementations are allowed to do certain things or allowed to emit certain errors.
I agree with your earlier assertion that the operations in question should be carefully defined. It cannot be an "input error" because there is no such thing in MF2. It can be a Bad Option error or an Unsupported Operation error. I might be convinced in the case of ZDT, but I'm having a hard time agreeing in the case of PDT. There are obviously different ways that such conversions can occur (does one interpret the PDT People want timekeeping to be simpler to use, not filled with arduous details. In any case, I suspect the action item here is for me to go back and write a design document for this option so that we color in all of the details prior to finalizing it (which might include removing or disabling bits of it) |
A couple of comments: If I supply an input parameter like $t being an implementation-defined datatype
I would expect to see the formatted datetime for 2025-01-21T18:30, not 2025-01-21T9:30. The same with This is then different than supplying a currency option to :currency; that needs to be illegal because currencies are not convertible. A system might also have two separate input parameters: $t being and formatting
|
(as chair of ICU4X-TC) That's fair; I just want to emphasize that time zone conversion is not free and takes a large amount of data (the TZDB). We have done a pretty good job of keeping MF2 dependencies minimal and I would really like if we didn't add TZDB as a requirement. |
This doesn't make a lot of sense to me. What kind of error do I get when I pass the string "hello world" as an input to be formatted as a date? Or a Symbol or a HashMap or some other nonsensical type? You can throw the same type of error if the type to be formatted contains a time zone. |
Probably Bad Operand.
If the operand were formattable without a It would probably be a good idea to include something like what we have under Unit Conversion for message-format-wg/spec/registry.md Lines 791 to 794 in ec9089d
|
Conflicts between time zones coming from different sources has been a persistent pain point that the Temporal champions have worked to avoid. It would be nice for MessageFormat to not repeat the same situation.
The problem is, what do you do if someone passes a
ZonedDateTime
to aMessageFormat
configured with a:datetime
field with atimeZone
option? There are two time zones to choose from, and none of the resolution options are great:In the Temporal specification, we handle the problem by disallowing a ZonedDateTime to be passed as input.
https://tc39.es/proposal-temporal/#sec-temporal-handledatetimevalue
However, a better design would be to forbid the formatter itself from having a time zone option, a luxury we didn't have when integrating Temporal with the pre-existing Intl.DateTimeFormat.
The text was updated successfully, but these errors were encountered: