const intervalToDuration = require("date-fns/intervalToDuration");
const parseISO = require("date-fns/parseISO");
const int3 = [
parseISO('2020-05-01T00:00:00'),
parseISO('2020-07-01T00:00:00'),
];
Object.defineProperty(
Array.prototype,
'start',
{
get: function() { return this[0]; },
},
);
Object.defineProperty(
Array.prototype,
'end',
{
get: function() { return this[1]; },
},
);
// this is ok, too!
const dur3 = intervalToDuration(int3);
console.log(dur3);