See the RoR pry console result:
[1] pry(main)> Date.tomorrow > Time.now
=> false
[2] pry(main)> Date.tomorrow.to_time > Time.now
=> true
[3] pry(main)> Date.tomorrow
=> Tue, 07 Oct 2014
[4] pry(main)> Time.now
=> 2014-10-06 22:52:40 -0400
Added timestamp result to let you know the rough values.
Because Date.tomorrow
is tomorrow and Time.now
in UTC is also tomorrow.
You'll notice you are doing this at 10:52pm
(e.g. EST
)
but that is actually 2:52am
tomorrow (given the -0400
difference)
Thus as tomorrow is not "greater than" tomorrow, that is false.
If you changed it to >=
it might then pass.
As you've found though, a workaround is use tack on .to_time
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With