fromNow static method

AgeDifference fromNow(
  1. DateTime? anotherDate
)

Implementation

static AgeDifference fromNow(DateTime? anotherDate) {
  if (anotherDate != null) {
    int years = _getDifferenceInUnits(Units.YEAR, anotherDate);
    int months = _getDifferenceInUnits(Units.MONTH, anotherDate);
    int days = _getDifferenceInUnits(Units.DAY, anotherDate);
    return AgeDifference(
      years: years,
      months: months,
      days: days,
    );
  }
  return AgeDifference();
}