d3.js - d3.time.scale() not working date inputs on IE 10 and Firefox -


i trying build bubble chart using d3.js. want bubble color filled according date. used following function generate color based on date given:

color = d3.time.scale().domain([new date('2013-07-23'), new date('2013-06-01')]).range(['#98e698', '#1e7b1e']); 

and while creating graph calling it

.style("fill", function(d) {return colour(new date("2013-07-8")); });  

the above code working fine chrome. in ie 10 , firefox color function returning nan instead of colour code. why?

return color(new date("2013-07-08"))  

with color spelled correctly , 0 in front of 8 works in ie10. reading new date(string) documentation, looks two digit month expected. in chrome:

>new date("2013-07-8")  mon jul 08 2013 00:00:00 gmt-0700 (pacific daylight time) 

in ie10:

>new date("2013-07-8")  invalid date  >new date("2013-07-08")  sun jul 7 17:00:00 pdt 2013  

to fix problem - clean dates adding 0 when necessary or use [d3.time.format] change strings dates3:

>var format = d3.time.format("%y-%m-%d");  >format.parse("2013-07-8")  mon jul 8 00:00:00 pdt 2013  

(this works in ie10)


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -