Hi Richard, In Chalten, if you don't talk of a year in particular, February 28th + 1 day always returns March 1st. This is because Chalten asumes the structure of a non-leap year for calculate this.
But, if you know the year, like in my previous example (the year 2012) then February 28th, 2012 + 1 day returns February 29th, 2012. Then, as 2012 is a leap year and I want to add 1 year to the last day of February of year 2012 (the 29th), then the result is the last day of February of 2013 (the 28th). Note that in one case we are talking about days of month (i.e. February 28th) and in the other case we are talking about dates (i.e. February 28th, 2012). Is it more clear now? By the way, reading your mail I found a little bug in Chalten. I will fix it in a couple of days. Thanks! Kind regards, Maxi 2015-03-20 14:47 GMT-03:00 Richard Sargent < richard.sarg...@gemtalksystems.com>: > Maximiliano Taborda wrote > > Hi all. > > > > The same examples using Chaltén: > > February twentyninth, 2012 next: 1 yearMeasure. "=> February 28th, > > 2013" > > This I don't get. Why would <February 28th> + 1 day + 1 year ever not be > March 1st? ~75% of the time it would be, but ~25% it would be a day less? > > > > March first, 2011 next: 1 yearMeasure. "=> March 1st, 2012" > > March first, 2011 next: 12 monthsMeasure. "=> March 1st, 2012" > > > > Hilaire, In Chaltén a year is a year so you don't need to care about of > > the > > number of days in it. > > > > Regards. > > Maxi > > > > > > 2014-12-02 16:37 GMT-03:00 Chris Cunningham < > > > cunningham.cb@ > > > >: > > > >> GenericYear does this. The generic Year will take > >> '2/29/2000' asDate + 1 year "=> 28 February 2001" > >> In other words, we want it at the same time next year; more importantly > >> the same month and close to what we have now. > >> Also: > >> '3/1/2001' asDate - 1 year "=> 1 March 2000" > >> Still, same month - we want to be at the beginning of the month the > >> previous year. > >> > >> Basically, my idea (and, more importantly, what I expect - hence my > code) > >> is that I want to pretend that we do have a field-based representation > >> and > >> make it work that way. except better (since there is no 2/29/2001). > >> > >> > Ej, which one of the followings is OK? > >> > '2011-03-01' asDate + 1 year "=> 2012-02-29" > >> > >> Well, I have a bug here. That needs to be fixed. > >> > >> -cbc > >> > >> > >> On Tue, Dec 2, 2014 at 8:34 AM, Sean P. DeNigris < > > > sean@ > > > > > >> wrote: > >> > >>> Esteban A. Maringolo wrote > >>> > Ej, which one of the followings is OK? > >>> > '2012-02-29' asDate + 1 year "=> 2013-02-28" > >>> > '2011-03-01' asDate + 1 year "=> 2012-02-29" > >>> > >>> One solution (just ignore the source ha ha) - > >>> > >>> > http://msdn.microsoft.com/en-us/library/system.datetime.addyears%28v=vs.110%29.aspx > >>> > >>> > >>> > >>> ----- > >>> Cheers, > >>> Sean > >>> -- > >>> View this message in context: > >>> http://forum.world.st/Duration-year-tp4791727p4793656.html > >>> Sent from the Pharo Smalltalk Developers mailing list archive at > >>> Nabble.com. > >>> > >>> > >> > > > > > > -- > View this message in context: > http://forum.world.st/Duration-year-tp4791727p4813662.html > Sent from the Pharo Smalltalk Developers mailing list archive at > Nabble.com. > >