Published
Edited
Mar 30, 2021
1 fork
4 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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more