IntlCalendar/IntlTimeZone and ext/date
| From: | Gustavo Lopes | Date: | Thu, 17 May 2012 21:34:37 +0000 |
| Subject: | IntlCalendar/IntlTimeZone and ext/date | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-60605@lists.php.net to get a copy of this message | ||
I've made some modifications to ext/intl's IntlCalendar/IntlTimeZone to improve interoperability.
* DateTimeZone is now accepted in all places time zones are expected in IntlCalendar.
* Added IntlTimeZone::toDateTimeZone() and IntlTimeZone::fromDateTimeZone().
* Added IntlCalendar::toDateTime() and IntlCalendar::fromDateTime().
Unfortunately, ext/date doesn't expose a lot of interfaces to manipulate its objects, so in some places I ended up having to call PHP_FUNCTIONs (in one case even twice doing to a bug; see https://github.com/cataphract/php-src/commit/3a81f90ebc51140484c617539b1a5fb0e117f4e2#L1R1264 ).
The conversion from DateTimeZone to IntlTimeZone is made through the ids only because ext/date doesn't expose interfaces to efficiently implement ICU's TimeZone. This may lead to some different behavior for the same time zone id if the databases are out of sync.
The changes are here: https://github.com/cataphract/php-src/compare/intl_calendar
If no one objects, I'll merge it soon.
--
Gustavo Lopes