Skip to content

dateFormatter

Returns a function that labels any date in dataArray exactly as formatDate would, reading the interval and position of every date once up front, so labeling all of them takes linear time. Pass the returned function the date to format and, optionally, the dates shown alongside it (sorted once for each new array it is given).

Parameters

import {dateFormatter} from "@d3plus/format";
dataArrayrequiredArray.<Date>

The full array of ordered Date Objects.

formatterDateFormatterDefault timeFormat

Optional custom format string or function.