score:1

Accepted answer

You should compare two date objects in your return statement.

svg.selectAll(".node").style("fill", function(d) {
   return new Date(((d.data.data.Cattime))) > new Date(h) ? "red" : "black";
}

Also, initially you are setting fill color of path as a style property, but in your update function you are setting it as an attribute.

Apparently, its value doesn't change when you set it as an attribute later on. So, either change update function to style or change your initialization to attribute.

working example


Related Query

More Query from same tag