Geoff B wrote: > On Sep 9, 3:17 pm, "Michael Koziarski" <[EMAIL PROTECTED]> wrote: > >> Much as it pains me to say it, the best option seems to be removing / >> deprecating the use of fractional years and months. There's just not >> a nice solution in either case. > > If the issue is not being able to exactly specify what a fractional > part of a month or year would be, keep in mind we do have the same > issue with days and weeks in time zones that observe DST -- days will > be 23-25 hours long, and weeks will vary in length if they cross a DST > transition. > > I do agree that the existing behavior of silently ignoring fractional > parts needs to be fixed, but honoring fractional parts for just :days > and :weeks, but not :months and :years, seems odd -- it would make > more sense to me to either allow fractional parts for all of these > args, and accept the imprecision (and mention it in the docs), or to > deprecate them all, and keep #advance precise.
The previous imprecise behaviour of 1.month.ago was a troll magnet, I'm loathe to start feeding those guys again... The reality is that people almost certainly have a finite number of these calls in their code, I don't think there'll be too many people doing: params[:months_ago].to_f.months.ago So deprecating or warning with fractional durations seems ok. But at the same time (1.5.months + 2.5.months).ago can work, right? So long as the call to advance resolves to no remainder everything's fine? -- Cheers, Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
