nette / database

💾 A database layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.
https://doc.nette.org/database
Other
512 stars 108 forks source link

ResultSet->normalizeRow ignores timezones #38

Open lookyman opened 10 years ago

lookyman commented 10 years ago

https://github.com/nette/database/blob/4b4a269d2b92d8fc922230996889128948a5e346/src/Database/ResultSet.php#L167

Tested for PostgreSQL's timestamp with time zone data type. This line seems to throw out timezone, when it is present. 2014-10-27 18:05:00 +0100 gets converted to 2014-10-27 18:05:00 with timezone specified in config date.timezone.

Something like $row[$key] = Nette\Utils\DateTime::from(strtotime($value)); works, but is not very nice. I would like to know if a) this is a bug or I am doing something wrong, and b) possible solutions?

milo commented 10 years ago

Timestamp with timezone is not covered by test. U guess, noone used it.

One possible solution is fixing normalization :)