var month = zeropad(m + 1); //months are 0-offset, sigh
// Get a 0 padded day string
var day = zeropad(d);
- var frac = hh * 3600 + mm * 60 + ss
+ var frac = hh * 3600 + mm * 60 + ss;
var ret = year + "/" + month + "/" + day;
if (frac) {
ret += " " + Dygraph.hmsString_(hh,mm,ss);
return Math.pow(base, exp);
};
-// For Dygraph.setDateSameTZ, below.
-Dygraph.dateSetters = {
- ms: Date.prototype.setMilliseconds,
- s: Date.prototype.setSeconds,
- m: Date.prototype.setMinutes,
- h: Date.prototype.setHours
-};
-
-/**
- * This is like calling d.setSeconds(), d.setMinutes(), etc, except that it
- * adjusts for time zone changes to keep the date/time parts consistent.
- *
- * For example, d.getSeconds(), d.getMinutes() and d.getHours() will all be
- * the same before/after you call setDateSameTZ(d, {ms: 0}). The same is not
- * true if you call d.setMilliseconds(0).
- *
- * @type {function(!Date, Object.<number>)}
- */
-Dygraph.setDateSameTZ = function(d, parts) {
- var tz = d.getTimezoneOffset();
- for (var k in parts) {
- if (!parts.hasOwnProperty(k)) continue;
- var setter = Dygraph.dateSetters[k];
- if (!setter) throw "Invalid setter: " + k;
- setter.call(d, parts[k]);
- if (d.getTimezoneOffset() != tz) {
- d.setTime(d.getTime() + (tz - d.getTimezoneOffset()) * 60 * 1000);
- }
- }
-};
-
/**
* Converts any valid CSS color (hex, rgb(), named color) to an RGB tuple.
*