Skip to content

Commit

Permalink
CLDR 40a0 uses a lowercase "temp" instead of "Temp" in ICU >= 70.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey authored and nikic committed Nov 2, 2021
1 parent 52cda6f commit c7a2441
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ext/intl/tests/dateformat_get_set_calendar_variant5.phpt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
--TEST--
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject()
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() for ICU >= 58.1 and < 70.1
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '58.1') < 0) die('skip for ICU >= 58.1'); ?>
if (!extension_loaded('intl')) die('skip intl extension not enabled');
if (version_compare(INTL_ICU_VERSION, '58.1') < 0 || version_compare(INTL_ICU_VERSION, '70.1') >= 0) die('skip for ICU >= 58.1 and < 70.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
Expand Down
54 changes: 54 additions & 0 deletions ext/intl/tests/dateformat_get_set_calendar_variant_icu70.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
--TEST--
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject() for ICU >= 70.1
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip');
if (version_compare(INTL_ICU_VERSION, '70.1') < 0) die('skip for ICU >= 70.1');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
ini_set("date.timezone", 'Atlantic/Azores');

$ts = strtotime('2012-01-01 00:00:00 UTC');

function d(IntlDateFormatter $df) {
global $ts;
echo $df->format($ts), "\n";
var_dump($df->getCalendar(),
$df->getCalendarObject()->getType(),
$df->getCalendarObject()->getTimeZone()->getId());
echo "\n";
}

$df = new IntlDateFormatter('fr@calendar=islamic', 0, 0, 'Europe/Minsk');
d($df);


//changing the calendar with a cal type should not change tz
$df->setCalendar(IntlDateFormatter::TRADITIONAL);
d($df);

//but changing with an actual calendar should
$cal = IntlCalendar::createInstance("UTC");
$df->setCalendar($cal);
d($df);

?>
--EXPECT--
dimanche 1 janvier 2012 ap. J.-C. à 03:00:00 heure de Kaliningrad
int(1)
string(9) "gregorian"
string(12) "Europe/Minsk"

dimanche 8 safar 1433 AH à 03:00:00 heure de Kaliningrad
int(0)
string(7) "islamic"
string(12) "Europe/Minsk"

dimanche 1 janvier 2012 ap. J.-C. à 00:00:00 temps universel coordonné
bool(false)
string(9) "gregorian"
string(3) "UTC"

0 comments on commit c7a2441

Please sign in to comment.