Skip to content

Conversation

@cmb69
Copy link
Member

@cmb69 cmb69 commented Jun 23, 2021

GMT+00:00 is recognized by ICU, and is normalized to GMT. There are no
issues when GMT+00:00 is passed to IntlTimeZone::createTimeZone(),
but passing it to IntlDateFormatter::__construct() causes a failure,
since there is an additional check regarding the validity. While
checking the validity of the result of TimeZone::createTimeZone()[1]
is a good idea, comparing the IDs is overly restrictive. Instead we
just check that the timezone is supported by ICU.

[1] https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/classicu_1_1TimeZone.html#a35da0507b62754ffe5d8d59c19775cdb


It might be a good idea to also add this check to intltz_create_time_zone(), or to drop it from IntlDateFormatter::__construct() altogether. Note that

//guaranteed non-null; GMT if timezone cannot be understood

is wrong; if the timezone is not recognized, it is Etc\Unknown.

GMT+00:00 is recognized by ICU, and is normalized to GMT.  There are no
issues when GMT+00:00 is passed to `IntlTimeZone::createTimeZone()`,
but passing it to IntlDateFormatter::__construct() causes a failure,
since there is an additional check regarding the validity.  While
checking the validity of the result of `TimeZone::createTimeZone()`[1]
is a good idea, comparing the IDs is overly restrictive.  Instead we
just check that the timezone is supported by ICU.

[1] <https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/classicu_1_1TimeZone.html#a35da0507b62754ffe5d8d59c19775cdb>
@cmb69 cmb69 added the Bug label Jun 23, 2021
@cmb69 cmb69 closed this in 1a01f78 Jun 28, 2021
@cmb69 cmb69 deleted the cmb/68471 branch June 28, 2021 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants