getYearsAndMonthsFromDateTime static method
Implementation
static getYearsAndMonthsFromDateTime(
DateTime dateTime, [
bool getMonths = false,
]) {
int days = DateTime.now().difference(dateTime).inDays;
int years = days ~/ 365;
int months = (days - (years * 365)) ~/ 30;
return getMonths ? months : years;
}