On Dec 8, 6:55 pm, Matt Darby <[EMAIL PROTECTED]> wrote:
>
>
> >>>>> 2008-12-08.monday = 2008-12-08
> >>>>> 2008-12-08-1.day = 2008-12-07
> >>>>> 2008-12-08.end_of_week = 2008-12-14
> >>>>> 2008-12-14-1.day = 2008-12-13
> >>>>> 2008-12-08 == [2008-12-07, 2008-12-13]
>
> ... n times later ...
>
>
>
> >>>>> 2008-12-08.monday = 2008-12-08
> >>>>> 2008-12-08-1.day = 1772-05-19
> >>>>> 2008-12-08.end_of_week = 3428-04-08
> >>>>> 3428-04-08-1.day = 3191-09-18
> >>>>> 2008-12-08 == [1772-05-19, 3191-09-18]
Perhaps the key thing to note is that 1772-05-19 is about 236 years
and 7 months ago, which (get your calculators out) is about 86400, ie
the number of seconds in a day. Whereas on an instance of Time, +/- 1
means +/- 1 second, on instances of Date/DateTime +/- means +/- 1
second. That is I suspect the basic problem.
On newer versions of rails, things like 1.day are smart enough to do
the right thing whether or not you add a date or a Time to them (the +
method on Date is overriden to check if the argument is a thing like
1.day).
Somewhere this has gone wrong. If you have any plugins that mess with
dates (or if you've being doing stuff like that yourself) then I'd
have a look at those - it could be something like once some random
model is loaded some extensions to Date are pulled in at that point
and from then onwards calculations are borked.
Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---