> On Dec 3, 2014, at 12:33 PM, Hilaire <[email protected]> wrote: > > Le 02/12/2014 17:34, Sean P. DeNigris a écrit : >> One solution (just ignore the source ha ha) - >> http://msdn.microsoft.com/en-us/library/system.datetime.addyears%28v=vs.110%29.aspx >> >> > > Something like ? > > Date>>addYears: integer > ^ Date > year: self year + integer > month: self monthIndex > day: ((self dayOfMonth = 29 > and: [(Year isLeapYear: self year + integer) not > and: [Year isLeapYear: self year]]) > ifTrue: [ 28 ] > ifFalse: [ self dayOfMonth])
From a brief read of the code it looks like the day formula should have a check for monthIndex == 2. Otherwise, January 29 can turn in to January 28.
