const intervalToDuration = require("date-fns/intervalToDuration");
const parseISO = require("date-fns/parseISO");
// this is also ok.
const int2 = new class {
get start() {
return parseISO('2020-05-01T00:00:00');
}
get end() {
return parseISO('2020-07-01T00:00:00');
}
};
const dur2 = intervalToDuration(int2);
console.log(dur2);