Try the attached code. The largest value of DateTime(2012, 1, 1) + dur!"days"(5 * n) that is less than DateTime(2013, 1, 1) is _not_ DateTime(2013, 1, 1) -dur!"days"(5). :-)
OK, so this has nothing to do with leap years, but that 5.days is an improper step.
