Hi, I’m trying to find some records by datetime.
My experience is this:
Event.all(:date.gte => day, :date.lt => day + 1).each do |event|
…
…
That expression is not working. It’s returning an event with day 31 when
“day” variable is 30.
For example:
event = 2010-12-31
day = 2010-12-30
That expression should not return that “event”, because I want events
between 2010-12-30 00:00 and 2010-12-30 23:59
The thing is, .lt is not doing its work IMO.
In irb it works, but not in datamapper.
irb(main):073:0> a
=> #<DateTime: 2010-12-25T00:00:00+00:00 (4911111/2,0,2299161)>
irb(main):074:0> b
=> #<DateTime: 2010-12-26T00:00:00+00:00 (4911113/2,0,2299161)>
irb(main):079:0> b < a + 1
=> false
Is this a bug?