I'm trying to ind the duration difference between two dates for the respective units in Dart. I'm looking at jiffy since it was inspired by moment.js and in moment.js that would be achieved by the following snippet:
const dateOne= moment('3/29/2020','M/D/YYYYY'); //29th March 2020
const currentDate = moment();
// get the difference between the moments
const diff = currentDate.diff(dateOne);
//express as a duration
const diffDuration = moment.duration(diff);
const diffDuration = {
months: diffDuration.months(), //6 months
days: diffDuration.days(), //14 days
hours: diffDuration.hours(), //21 hours
minutes: diffDuration.minutes(), //55 minutes
seconds: diffDuration.seconds(), //44 seconds
}
But with Jiffy I can only find the difference, not the difference duration
var jiffy1 = Jiffy(); //get current time
var jiffy2 = Jiffy("2020-03-29", "yyyy-MM-dd");
var _months = jiffy1.diff(jiffy2, Units.MONTH); //6
var _days = jiffy1.diff(jiffy2, Units.DAY); //197 days
var _hours = jiffy1.diff(jiffy2, Units.HOUR); //284,99 hours
var _seconds = jiffy1.diff(jiffy2, Units.SECOND );
var _minutes = jiffy1.diff(jiffy2, Units.MINUTE);
Is there any way to achieve that functionality in Dart (Flutter) it doesn't have to be with a package. I did consider the DateTime class but it seems to give the same output as well, just with less units avaliable