Description
Other calendars like islamic, buddhist instead of chinese are working like expected. The following code fails (discussed in german language here ):
<?php
$locale = 'de_DE@calendar=chinese';
$traditionalFormatter = new IntlDateFormatter(
$locale,
IntlDateFormatter::MEDIUM,
IntlDateFormatter::SHORT,
'Europe/Berlin',
IntlDateFormatter::TRADITIONAL
);
$gregorianFormatter = new IntlDateFormatter(
$locale,
IntlDateFormatter::MEDIUM,
IntlDateFormatter::SHORT,
'Europe/Berlin',
IntlDateFormatter::GREGORIAN
);
$dateTime = DateTime::createFromFormat('Y-m-d H:i:s', '2022-10-30 23:27:06');
$traditionalDate = $traditionalFormatter->format($dateTime);
$parsedTimestamp = $traditionalFormatter->parse($traditionalDate);
var_dump($gregorianFormatter->format($dateTime));
var_dump($gregorianFormatter->format($parsedTimestamp));
Resulted in this output:
string(18) "2022 Okt. 31 00:27"
string(17) "2599 Dez. 5 00:27"
But I expected this output instead:
string(18) "2022 Okt. 31 00:27"
string(17) "2022 Okt. 31 00:27"
PHP Version
PHP 7.4.33, PHP 8.0.27, PHP 8.1.14, PHP 8.2.1
Operating System
No response
Description
Other calendars like islamic, buddhist instead of chinese are working like expected. The following code fails (discussed in german language here ):
Resulted in this output:
But I expected this output instead:
PHP Version
PHP 7.4.33, PHP 8.0.27, PHP 8.1.14, PHP 8.2.1
Operating System
No response