Skip to content

Instantly share code, notes, and snippets.

@Reanmachine
Created December 5, 2022 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Reanmachine/e813ee748fe74e3b561e4073c631d4d5 to your computer and use it in GitHub Desktop.
Save Reanmachine/e813ee748fe74e3b561e4073c631d4d5 to your computer and use it in GitHub Desktop.
Test Timezone Discrepancy
<?php
$timezones = [
'America/Nuuk',
'Asia/Qostanay',
'Europe/Kyiv',
'Pacific/Kanton',
];
foreach ($timezones as $tz) {
echo $tz . "\n";
echo " - Present: " . yn(testNewTimezonePresent($tz)) . "\n";
echo " - Formatter: " . yn(testNewTimezoneSupportedByFormatter($tz)) . "\n";
}
function yn($v) {
return $v ? 'Yes' : 'No';
}
function testNewTimezonePresent($tz) {
return in_array($tz, timezone_identifiers_list());
}
function testNewTimezoneSupportedByFormatter($tz) {
return !empty(\IntlDateFormatter::create('en_US' ,IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Europe/Kyiv', IntlDateFormatter::GREGORIAN));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment