mirror of https://github.com/vitalif/dimple
Fixed potential limitation in pull request #27
Not a bug but possibly a limitation for certain date formats.master
parent
5cb73e7fd4
commit
61119bbe17
|
@ -4,13 +4,17 @@
|
|||
this._parseDate = function (inDate) {
|
||||
// A javascript date object
|
||||
var outDate;
|
||||
if (!isNaN(inDate)) {
|
||||
// If inDate is a number, assume it's epoch time
|
||||
outDate = new Date(inDate);
|
||||
} else if (this.dateParseFormat === null || this.dateParseFormat === undefined) {
|
||||
// If nothing has been explicity defined you are in the hands of the browser gods
|
||||
// may they smile upon you...
|
||||
outDate = Date.parse(inDate);
|
||||
if (this.dateParseFormat === null || this.dateParseFormat === undefined) {
|
||||
// Moved this into the condition so that using epoch time requires no data format to be set.
|
||||
// For example 20131122 might be parsed as %Y%m%d not treated as epoch time.
|
||||
if (!isNaN(inDate)) {
|
||||
// If inDate is a number, assume it's epoch time
|
||||
outDate = new Date(inDate);
|
||||
} else {
|
||||
// If nothing has been explicity defined you are in the hands of the browser gods
|
||||
// may they smile upon you...
|
||||
outDate = Date.parse(inDate);
|
||||
}
|
||||
} else {
|
||||
outDate = d3.time.format(this.dateParseFormat).parse(inDate);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue