[php-src] Issue #11769: Inconsistent timezones support for date/time ext and Intl ext

From: Date: Sat, 22 Jul 2023 19:24:03 +0000
Subject: [php-src] Issue #11769: Inconsistent timezones support for date/time ext and Intl ext
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245014@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11769
Author: jorgsowa

### Description

I noticed that on different systems results may differ if we use analogical functions of Date/Time
extension and Intl extension. The reason for different output is the version of the tz
database bundled with the PHP (through time lib) and version of ICU installed in the system.

https://3v4l.org/qP32g#v8.2.7

```php
<?php

$utcDatetime = '1990-01-01 00:00:00';

$customTimeZone = new DateTimeZone("America/Pangnirtung");
$date = new DateTimeImmutable($utcDatetime, new DateTimeZone("UTC"));
$newDate = $date->setTimeZone($customTimeZone);
var_dump($newDate->format("c"));

$formatter = new IntlDateFormatter("en-US", timezone: "UTC");
$formatter->setTimezone($customTimeZone);
$formatter->setPattern("y-MM-dd'T'HH:mm:ssxxx");
var_dump($formatter->format($date));

var_dump("INTL_ICU_VERSION: " . INTL_ICU_VERSION);
```

Resulted in this output:
```
string(25) "1989-12-31T19:00:00-05:00"
string(25) "1989-12-31T20:00:00-04:00"
string(22) "INTL_ICU_VERSION: 57.1"
```

But I expected this output instead:
```
string(25) "1989-12-31T19:00:00-05:00"
string(25) "1989-12-31T19:00:00-05:00"
string(22) "INTL_ICU_VERSION: 70.1"
```

Using the same tz database would improve stability across systems and the consistency
between functions of PHP.

### PHP Version

PHP 8.2.7

### Operating System

_No response_


Thread (1 message)

  • jorgsowa
« previous php.bugs (#245014) next »