Time.parse('2009-01-01')+15.days+0.5.days => Fri Jan 16 00:00:00 +0100 2009 Time.parse('2009-01-01')+15.days+0.5.days.to_i => Fri Jan 16 12:00:00 +0100 2009 12.hours gone :( ruby version 1.8.7
Time.parse('2009-01-01')+15.days+0.5.days => Fri Jan 16 00:00:00 +0100 2009 Time.parse('2009-01-01')+15.days+0.5.days.to_i => Fri Jan 16 12:00:00 +0100 2009 12.hours gone :( ruby version 1.8.7
I think it would be more expressive to say:
Time.parse(‘2009-01-01’)+15.days+12.hours
which works properly. The problem appears to be that 0.5.days returns a Float, whereas 15.days returns a FixNum.
yep, it works with hours.
0.5.days is not a float though (in second terms) very strange behavior.