yearsAgo method

DateTime yearsAgo(
  1. int years
)

Return the point in time years ago on the same date.

Implementation

DateTime yearsAgo(int years) {
  var time = now();
  var y = time.year - years;
  var d = clampDayOfMonth(year: y, month: time.month, day: time.day);
  return DateTime(y, time.month, d, time.hour, time.minute, time.second,
      time.millisecond);
}