moni sogani moni sogani - 1 year ago 80
React JSX Question

Not able to parse Date in unix time format

i am very new to coding and stucked somewhere while making LineTooltip using react-d3 library.
i am getting time unix time format like:1450274696000 in json and need to parse it and show d,m in x-axis
i am using this function:

var parseDate = d3.time.format("%B %d, %Y");
var x = function(d) {
return parseDate(new Date(d.index))

and calling linetooltip as

<LineTooltip width= {1200} height= {400} interpolate = {"cardinal"} data= {chartData} chartSeries= {chartSeries} x= {x} xScale={xScale} />

Please help me out!...
Thanks in advance

Answer Source

no neeed to pasrse data as milliseconds can be directly converted to Date object, like this

 var x = function(d) {
 return new Date(d.index)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download