I'm trying to convert date formats in d3.js Here's my code, using d3.js (the dates are being accessed on mouseover of points on the map):
d3.selectAll(".events")
.on("mouseover", function(d) {
console.log(d.startDate)
}
Which is giving me output such as:
2019-02-23
I want it to read Saturday February 23 2019. When I try:
d3.selectAll(".events")
.on("mouseover", function(d) {
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
console.log(d.startDate.toLocaleDateString("en-US", options))
}
I get an error saying:
d.startDate.toLocaleDateString is not a function
at SVGCircleElement
Curious what I'm doing wrong here.