Published
Edited
Jan 18, 2021
1 fork
Importers
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function heightToUnix (filEpoch) {
return (filEpoch * 30) + FILECOIN_GENESIS_UNIX_EPOCH
}
Insert cell
function unixToHeight (unixEpoch) {
return Math.floor((unixEpoch - FILECOIN_GENESIS_UNIX_EPOCH) / 30)
}
Insert cell
function dateToUnixEpoch(date, time='00:00') {
return new Date(`${date}T${time}Z`).getTime() / 1000
}
Insert cell
function dateToHeight (date, time='00:00') {
return unixToHeight(dateToUnixEpoch(date,time))
}
Insert cell
function heightToDate (inputHeight) {
const d = new Date()
d.setTime(heightToUnix(inputHeight) * 1000)
return d
}
Insert cell
Insert cell
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