felixge/node-mysql — pull request #289 by BryanDonovan (2012-09-12 22:40:48+00:00)
Title: Support for UTC dates as a config param

This pull request adds support for an optional config param named "utc" (boolean), when, if set, causes dates in result packets to be treated as UTC. In particular, the RowDataPacket.prototype._typeCast() function does this:

```
if (utc) {
dateString += 'Z';
}
```
This functionality is needed because setting process.env.TZ is not reliable. If any Date manipulation (E.g., new Date.getTimezoneOffset()) happens before process.env.TZ is set, then the Date class's timezone will be stuck at what it was before process.env.TZ is set. See related bug #128.

I've added two new integration tests that cover how node-mysql deals with dates and timezones.

I can't say I like adding another param to these functions, e.g.,:

```
RowDataPacket.prototype.parse = function(parser, fieldPackets, typeCast, nestTables, utc) {

```
Should I try adding an options hash as the third param in that function instead? It would hold the 'typeCast', 'nestTables', and 'utc' args.