yearsAgo method

DateTime yearsAgo (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 new DateTime(y, time.month, d, time.hour, time.minute, time.second,
      time.millisecond);
}