felixge/node-mysql — pull request #192 by ichernev (2012-04-20 20:53:51+00:00)
Title: Pass localtime to mysql instead of iso time

When reading dates, the Date constructor is used, which expects localtime. Also mysql timestamp data-type expects localtime for input/output.

From another viewpoint, if prior the patch, you insert a date (in a timestamp *or* datetime object) and then read it back, you get it offset by the local timezone. If you apply the batch both timestamp and datetime objects are read/written properly.

Even this fix isn't perfect. It won't work properly if mysql timezone differs from node's timezone. Maybe a function can be added in the client "syncTz" which reads the mysql timezone (select @@session.time_zone) and if it isn't SYSTEM, it calculates the offset and then serializes dates for the servers TZ.