Published
Edited
Mar 30, 2021
1 fork
5 stars
Insert cell
Insert cell
Insert cell
// require("https://bundle.run/edtf@3.1.0/index.js")
edtf = require(await FileAttachment("edtf.js").url())
Insert cell
Insert cell
range = edtf('1950/1959')
Insert cell
{
const svg = d3.create("svg").attr("viewBox", [0, -30, width, 60]);
const time = d3.scaleUtc(d3.extent(range), [20, width - 20]);
const axis = d3.axisTop(time).tickValues([...range]); // https://github.com/d3/d3-axis/pull/77
svg.append("g").call(axis);
return svg.node();
}
Insert cell
[...edtf('2016-05').through(edtf('2016-01'))]
Insert cell
edtf('2016-05')
Insert cell
Insert cell
edtf('1950-06-XX/2004-07-03').covers(edtf('1975-01'))
Insert cell
Insert cell
edtf('2016-?05').uncertain.is('month')
Insert cell
Insert cell
edtf('2016-01').next()
Insert cell
edtf('2016-XX').next()
Insert cell
edtf(new Date()).next() // default precision is 1 second
Insert cell
edtf('2016-04~/2016-05')
Insert cell
edtf('2016-06/2016-09').covers(edtf('2016-08-24')) // true
Insert cell
edtf('2016-06/2016-09').covers(edtf('2016-10-24')) // false
Insert cell
edtf('2016-02-28').next()
Insert cell
B = edtf('2016-02-29').next()
Insert cell
B.min
Insert cell
B.max
Insert cell
B.toGMTString()
Insert cell
B.values
Insert cell
Insert cell
[...edtf.sample({ count: 19 })]
Insert cell
Insert cell
d3 = require("d3@6")
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