Published
Edited
Jun 15, 2019
Insert cell
Insert cell
luxon = import('https://unpkg.com/luxon@1.16.0/src/luxon.js?module')
Insert cell
moment = require('moment@2.24.0/moment.js')
Insert cell
function addMinutes(date, minutes) {
return new Date(date.getTime() + minutes*60000);
}
Insert cell
Insert cell
// Prints 2014-11-03T00:00:00.000Z
console.log(addMinutes(new Date('2014-11-02'), 60*24));
Insert cell
Insert cell
// Prints 2014-11-03T00:00:00.000Z
console.log(luxon.DateTime.fromJSDate(new Date('2014-11-02')).plus({minutes: 24*60}).toJSDate())
Insert cell
// Prints 2014-11-03T00:00:00.000Z
console.log(moment(new Date('2014-11-02')).add(24*60, 'm').toDate())
Insert cell
// Prints 2014-11-03T01:00:00.000Z
console.log(luxon.DateTime.fromJSDate(new Date('2014-11-02')).plus({days: 1}).toJSDate())
Insert cell
console.log(moment(new Date('2014-11-02')).add(1, 'd').toDate())
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