Published
Edited
Jan 19, 2022
Insert cell
Insert cell
data = JSON.parse(`[{"occurrencedate":"2022-01-01 13:05:33 -0500"},{"occurrencedate":"2022-01-02 13:05:33 -0500"},{"occurrencedate":"2022-01-03 13:05:33 -0500"},{"occurrencedate":"2022-01-04 13:05:33 -0500"},{"occurrencedate":"2022-01-05 13:05:33 -0500"}]`)
Insert cell
Insert cell
new Date("2022-01-03 13:05:33 -0500")
Insert cell
Insert cell
parse = d3.utcParse("%Y-%m-%d %H:%M:%S %Z")
Insert cell
dataParsed = data.map((d) => ({occurrencedate: parse(d.occurrencedate)}))
Insert cell
Insert cell
viewof start = Inputs.date({label: "Start date", value: "2022-01-02"})
Insert cell
viewof end = Inputs.date({label: "End date", value: "2022-01-04"})
Insert cell
Insert cell
start instanceof Date
Insert cell
end instanceof Date
Insert cell
Insert cell
dataParsed.filter(d => d.occurrencedate >= start && d.occurrencedate <= end)
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more