I wrote a very nice routine which would iterate over a few days.
Today I found my loop never ending !?! And this is very scary because the routine is a background process that needs to iterate over the last x-days.
But there’s a problem when you’re living in The Netherlands and you have to use daylight savings.
Try this code:
=> Sun Mar 30
WTF !! 2008-03-30 => Tomorrow => 30 March 2008 ?!?
I indeed complained, that time was passing so quickly. But I didn’t mean to keep it stuck at 30 March!
Oh.. I’ts only my Rails Application…
How’s this possible?
=> Sun Mar 30 23:00:00 +0200 2008
At 30-03-2008 the clock has been set back for daylight savings. Well I assume rails simply adds 24 hours with the method tomorrow. And yesterday we had 25 hours.
More info about this bug: http://dev.rubyonrails.org/ticket/2353
My temporary solution is to add some hours to tomorrow.
>> tomorrow_time = "2008-03-30".to_date.to_time.tomorrow + 12*60*60
=> Mon Mar 31 11:00:00 +0200 2008
=> Mon, 31 Mar 2008
Sometimes I hate Ruby on Rails!