danvk/dygraphs — pull request #291 by joanpau (2014-01-16 21:23:33+00:00)
Title: Added support for UTC date time labels.

* dygraph-utils.js:
new utc switch parameter for `Dygraph.hmsString_`
and `Dygraph.dateString_`.

* dygraph.js:
new utc date axis formater `Dygraph.dateUTCAxisFormatter`.

The `dateUTCAxisFormatter` provided is just a copy of the orginal `dateAxisFormatter`,
but using UTC date functions instead of the local time ones.
An alternative approach is to add an `utc` boolean paramater and the related logic
into the `dateAxisFormatter` function (as in `Dygraph.hmsString_` in `dygraph-utils.js`)
and provide the following specializations:
```js
Dygraph.dateUTCAxisFormatter = function(date, granularity) {
return Dygraph.dateAxisFormatter(date, granularity, true)
}

Dygraph.dateLocalTimeAxisFormatter = function(date, granularity) {
return Dygraph.dateAxisFormatter(date, granularity, false)
}
```
I (@joanpau) am not sure if the modified `dateAxisFormatter` would be backwards
compatible then (would the third parameter break some formatter interface?).
If it was, the local time specialization would not be needed.