I\'m looking for a way to use DateTime to parse two dates, to show the difference.
I want to have it on the format: \"X years, Y months, Z days\".
For J
What you are looking for is the Dart DateTime class You can get close to what you want in moment.js with
main() {
var a = DateTime.utc(2015, 11, 29);
var b = DateTime.utc(2007, 06, 27);
var years = a.difference(b);
print(years.inDays ~/365);
}
There is no inYears or inMonths option for DateTime though that's why the year is divided in the print. the difference function returns the difference in seconds so you have to process it yourself to days.