On 25 December 2010 04:59, Javier 12 <[email protected]> wrote:
> 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

What is the full value of event datetime (including time and timezone)
for a failing one?  Also the full value of day.

Colin

>  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?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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.
>
>

-- 
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.

Reply via email to