Unlisted
Edited
Sep 22, 2023
Importers
Insert cell
Insert cell
Insert cell
drawCalendar({
markDates: [
{
start: new Date("2022-02-08"),
end: new Date("2022-04-13"),
name: "vacation"
},
{
start: new Date("2022-04-22"),
end: new Date("2022-04-26"),
name: "vacation2"
}
]
})
Insert cell
Insert cell
drawCalendar({
markDates: [
{
start: new Date("2022-04-08"),
end: new Date("2022-04-13"),
name: "vacation"
},
{
start: new Date("2022-04-22"),
end: new Date("2022-04-26"),
name: "vacation2"
}
],
overallDates: {
start: new Date("2022-02-01"),
end: new Date("2022-04-30")
}
})
Insert cell
Insert cell
drawCalendar({
dates: {
data: aapl.map((d) => ({ ...d, date: d.Date })).filter((d, i) => i < 48),
value: "Close"
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
a = getDaysArray([
{
start: new Date("2022-03-08"),
end: new Date("2022-09-13"),
name: "Hase"
}
])
Insert cell
test({
markDates: [
{
start: new Date("2022-03-08"),
end: new Date("2022-04-13")
}
]
})
Insert cell
function test(_config) {
const markDates = _config.markDates;
const overallDates = _config.overallDates ? _config.overallDates : {};

const firstDay = overallDates.start
? overallDates.start
: new Date(
Date.UTC(
markDates[0].start.getUTCFullYear(),
markDates[0].start.getUTCMonth(),
1
)
);
const lastDay = overallDates.end
? overallDates.end
: new Date(
Date.UTC(
markDates[markDates.length - 1].end.getUTCFullYear(),
markDates[markDates.length - 1].end.getUTCMonth(),
1
)
);
return d3.utcDay();
}
Insert cell
cal = d3.utcDay.range(new Date("2022-03-08"), nextDay(new Date("2022-04-13")))
Insert cell
Insert cell
cal.map((d) => d.toString()).includes(new Date("2022-03-05").toString())
Insert cell
d3.utcDay(new Date().setDate(new Date("2021-02-13").getDate() + 0))
Insert cell
d3.utcMonth.ceil(new Date("2021-02-13"))
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