I'm trying to compare two DateTime objects. However, I don't quite understand the result.
DateTime.parse("2014-09-14 01:12:03 +0200")
>> Sun, 14 Sep 2014 01:12:03 +0200
Foo.order("created_at").last.created_at.to_datetime
>> Sun, 14 Sep 2014 01:12:03 +0200
But
Foo.order("created_at").last.created_at.to_datetime === DateTime.parse("2014-09-14 01:12:03 +0200")
true
Foo.order("created_at").last.created_at.to_datetime > DateTime.parse("2014-09-14 01:12:03 +0200")
true
Why is the result of the >
comparison not false
? (Rails 4.0.9)
Edit: I got it working using the ===
operator. But it still returns true
when I use the >
operator.