jpfuentes2 / php-activerecord

ActiveRecord implementation for PHP
http://www.phpactiverecord.org/
Other
1.32k stars 443 forks source link

Fix timezone bug in active record DateTime creation #521

Closed litchie closed 8 years ago

litchie commented 8 years ago

Previously ActiveRecord::DateTime object was created from a PHP DateTime's formatted string ('Y-m-d h:i:s T'), T represents a 3 letter time zone abbreviation. And unfortunately UTC+08:00 and UTC-06:00 share a same abbr. CST. So our fix is to use the timezone information directly fetched from PHP DateTime object without using any formatting.

koenpunt commented 8 years ago

Can you add a test for the faulty behavior? Thanks!

jpfuentes2 commented 8 years ago

Thanks, @litchie. It seems we have another effort in #532 which not only fixes the timezone truncation but adds customization of DateTime for AR. I'm closing this in favor of #532.