这是indexloc提供的服务,不要输入任何密码
Skip to content

[intl4x] Timezone problems #978

@mosuem

Description

@mosuem

Notes from an offline discussion with @robertbastian

There is a general problem with ICU4X and ECMA compatibility regarding zoned formatting.

  • ICU4X interprets a datetime as in the target timezone, so would format 11:00 in Los Angeles as 11:00, PST regardless of the local time.
  • ECMA interprets a datetime as in the local timezone, so would format 11:00 in Los Angeles as 02:00, PST, if the user is in Berlin.

We would prefer having ICU4X's behavior, but ECMA does not expose the calculation, it's only implicitly done during formatting.

Possible solutions:

  1. Have the user input the offset for the timezone manually, and add it to the date time in ICU4X. Pro: This will result in the same behavior as ECMA, formatting 11:00 as 02:00. Con: This will fail for edge cases such as DST changes.
  2. Same thing, but subtract in ECMA, to get the ICU4X behavior.
  3. Same thing, but only allow UTC datetimes - this resolves the edge cases.
  4. Read a timezone database using FFI, and use it to adapt the ICU4X code to match ECMA. Pro: Everything will work great, no additional code size. Con: Can't be read on windows, the behavior will be the ECMA one, which is not desirable. Is additional work.

Options for next steps:

  1. Remove all timezone formatting for now, and implement solution 4 later on.
  2. Keep the user input of offsets, and the manual subtraction, so solution 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions