1--TEST--
2MessageFormatter::format(): DateTime accepted to format dates and times
3--INI--
4date.timezone=Atlantic/Azores
5--EXTENSIONS--
6intl
7--SKIPIF--
8<?php if (version_compare(INTL_ICU_VERSION, '72.1') < 0) die('skip for ICU >= 72.1'); ?>
9--FILE--
10<?php
11ini_set("intl.error_level", E_WARNING);
12//ini_set("intl.default_locale", "nl");
13
14$fmt = <<<EOD
15{0,date} {0,time}
16EOD;
17
18$dt = new DateTime("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon"));
19$dti = new DateTimeImmutable("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon"));
20
21$mf = new MessageFormatter('en_US', $fmt);
22
23var_dump($mf->format(array($dt)));
24var_dump($mf->format(array($dti)));
25
26?>
27--EXPECT--
28string(24) "May 6, 2012 5:00:42 PM"
29string(24) "May 6, 2012 5:00:42 PM"
30