-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed
Description
| Q | A |
|---|---|
| Bug report? | yes |
| Feature request? | yes |
| BC Break report? | no |
| RFC? | yes |
| Symfony version | any |
We make use of the intl extension to nicely render DateTime objects according to the active locale and timezone. The problem with this combination is that it are two different kind of PHP modules, and their datasets do not completely match.
When the diff gets calculate over the intl and datetime timezones, you expected the result to be empty, but it is not. The outcome looks like the following:
"America/Fort_Nelson",
"America/Punta_Arenas",
"Antarctica/Troll",
"Asia/Atyrau",
"Asia/Barnaul",
"Asia/Chita",
"Asia/Famagusta",
"Asia/Khandyga",
"Asia/Srednekolymsk",
"Asia/Tomsk",
"Asia/Ust-Nera",
"Asia/Yangon",
"Europe/Astrakhan",
"Europe/Busingen",
"Europe/Kirov",
"Europe/Saratov",
"Europe/Ulyanovsk",
"Pacific/Bougainville"
This can be solved by using the intersect of both datasets instead:
$intlTimezones = iterator_to_array(\IntlTimeZone::createEnumeration());
$timezoneIntersection = array_intersect($intlTimezones, \DateTimeZone::listIdentifiers());Would it be wise to let the TimezoneType choice populater take this into account in case the intl extension is available / activated? Twig does use intl by default if I'm correct?