`IntlDateFormatter` returns wrong output for 1940 date in Amsterdam timezone
まだ誰も着手していません。
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.1k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
$timezone = new DateTimeZone("Europe/Amsterdam");
$date = new DateTime("1940-01-01 00:00:00", $timezone);
var_dump($date);
$formatter = new IntlDateFormatter("en-US");
var_dump($formatter->format($date));
Resulted in this output:
object(DateTime)#2 (3) {
["date"]=>
string(26) "1940-01-01 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
string(69) "Sunday, December 31, 1939 at 11:40:00 PM Coordinated Universal Time"
But I expected this output instead:
object(DateTime)#2 (3) {
["date"]=>
string(26) "1940-01-01 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
string(48) "Monday, January 1, 1940 at 12:00:00 AM GMT+00:20"
Additional details
Until 16 May 1940, The Netherlands used UTC+00:20 as timezone. It looks like IntlDateFormatter is not aware of the UTC+00:20 timezone, so it outputs the date in UTC.
The occurrence of the problem seems related to the version of the ICU library:
| Environment | Source | PHP version | ICU version | Output |
|---|---|---|---|---|
| 3v4l.org | https://3v4l.org/UoVSs | 8.2.4 | 57.1 | ✅ As expected |
| Docker + Debian libicu | Dockerfile | 8.2.4 | 67.1 | ❌ Wrong |
| Docker + latest libicu | Dockerfile | 8.2.4 | 72.1 | ❌ Wrong |
I am not familiar enough with the ICU library to assess whether the problem originates there. Since the wrong output is present in PHP when using the latest versions (of PHP and the ICU library), I am submitting the bug here.
PHP Version
8.2.4
Operating System
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Europe/Amsterdam に対する IntlDateFormatter の例を再現し、参照されている Debian および latest-ICU Dockerfile を使って、issue に記載されている ICU バージョンを比較します。誤った過去のオフセットが PHP と ICU のどちらに由来するのかを追跡します。formatter が期待される 1940 UTC+00:20 の結果を返すか、issue が ICU upstream の制限として文書化されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- internationalization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100