const intervalToDuration = require("date-fns/intervalToDuration");
const parseISO = require("date-fns/parseISO");
// ok
const int1 = {
start: parseISO('2020-05-01T00:00:00'), // Date
end: parseISO('2020-07-01T00:00:00'), // Date
};
const dur1 = intervalToDuration(int1);
console.log(dur1); // Object {days: 0, hours: 0, minutes: 0, months: 2, seconds: 0, years: 0}