Boop Boop wrote:
A little app I wrote has a calendar view for three months.
Everything went fine until today, when it didn't display August -
September - October, but August - August - September. Next month had
become this month.
=> Wed Aug 01 21:13:55 +0200 2007
=> Fri Aug 31 21:14:01 +0200 2007
=> Sat Sep 01 21:14:13 +0200 2007
Especially annoying since the rdoc for
ActiveSupport::CoreExtensions::Numeric::Time pretends that:
These methods use Time#advance for precise date calculations when using
from_now, ago, etc. as well as adding or subtracting their results from a Time object. For example:
# equivalent to Time.now.advance(:months => 1)
It's NOT equivalent. It's broken.
Where did you get this?
I just checked the API docs at:
And they explicitly state that:
If you need precise date calculations that doesn‘t just treat
months as 30 days, then have a look at Time#advance.
Some of these methods are approximations, Ruby‘s core Date and
Time should be used for precision date and time arithmetic