score:2

Accepted answer

It parses a string to a date.

https://github.com/mbostock/d3/wiki/Time-Formatting#parse

In the context of var parseDate = d3.time.format("%b %Y").parse;

parseDate.parse is not a function makes sense because parseDate is the function, not parseDate.parse. You call it like parseDate('1/1/2016'), not parseDate.parse('1/1/2016')

You don't need to stick parse at the end. You can do

var parseDate = d3.time.format("%b %Y")

and then

parseDate.parse('1/1/2015).

Example from D3 docs.

var format = d3.time.format("%Y-%m-%d");
format.parse("2011-01-01"); // returns a Date
format(new Date(2011, 0, 1)); // returns a string

This allows you to format and parse a string. The first example only allows you to parse.


Related Query

More Query from same tag