Where do I report this DateTime bug?

I have isolated what appears to be a bug in the Rails extensions to
DateTime, but I don’t know where to report it.

The punch line is that this code:

TestRecord.create!(:f_datetime => (expected = DateTime.jd(2000000)))
found = TestRecord.first.f_datetime

puts("expected == found => #{expected == found}")
puts("expected = #{expected.to_formatted_s(:rfc822)}")
puts("found =    #{found.to_formatted_s(:rfc822)}")

generates this response:

expected == found => true
expected = Wed, 14 Sep 0763 00:00:00 +0000
found =    Sat, 14 Sep 0763 00:00:00 +0000

So. The dates are equal, but was that day a Wednesday or a Saturday?

PS: I’m using postgresql with Ruby 1.93 and Rails 3.2.1

On 21 June 2012 17:36, Fearless F. [email protected] wrote:

puts(“expected = #{expected.to_formatted_s(:rfc822)}”)
puts(“found = #{found.to_formatted_s(:rfc822)}”)

generates this response:

expected == found => true
expected = Wed, 14 Sep 0763 00:00:00 +0000
found = Sat, 14 Sep 0763 00:00:00 +0000

So. The dates are equal, but was that day a Wednesday or a Saturday?

Can you post the contents of schema.rb section for the table.
Also it would be interesting to put in some inspect debug for expected
and found.

Colin

Can you post the contents of schema.rb section for the table.
Also it would be interesting to put in some inspect debug for expected
and found.

Colin:

Done. See Demonstration of bug in DateTime#to_formatted_s(:rfc822) · GitHub for code and results.

As for “inspect debug for expected and found”, I assume you mean like
this:

puts("expected = #{expected.to_formatted_s(:rfc822)}

(#{expected.inspect})")
puts(“found = #{found.to_formatted_s(:rfc822)}
(#{found.inspect})”)

=>

expected = Wed, 14 Sep 0763 00:00:00 +0000 (Wed, 14 Sep 0763 00:00:00
+0000)
found = Sat, 14 Sep 0763 00:00:00 +0000 (Sat, 14 Sep 0763 00:00:00
UTC +00:00)

HTH.

  • ff

I’ve created:

two DateTime objects are == but print differently · Issue #6814 · rails/rails · GitHub

… which seems like the correct place to report this. I’m sure I’ll
hear from the rails admin team soon enough if that’s not the right
place.

  • ff

On 21 June 2012 18:05, Fearless F. [email protected] wrote:

puts(“expected = #{expected.to_formatted_s(:rfc822)}
(#{expected.inspect})”)
puts(“found = #{found.to_formatted_s(:rfc822)}
(#{found.inspect})”)

What is the class of found?

Colin

Colin L. wrote in post #1065800:

What is the class of found?

I updated the above mentioned gist. ‘expected’ is a DateTme, ‘found’ is
ActiveSupport::TimeWithZone.

Also I don’t think you have told us which versions of ruby and rails
you are using.

Apologies, this was buried at the end of the OP:

PS: I’m using postgresql with Ruby 1.93 and Rails 3.2.1

But this is all now moot: I posted this as a Rails issue:

two DateTime objects are == but print differently · Issue #6814 · rails/rails · GitHub

where @pixeltrix patiently educated me on the anomalies of ancient
calendar systems. The best line was “[calendar reforms] can lead to
oddities like William Shakespeare and Miguel de Cervantes dying on the
same date but 10 days apart.” He also suggests using #gregorian to
adjust the datetime before converting to time, e.g:

>> DateTime.jd(2000000).gregorian
=> Wed, 18 Sep 0763 00:00:00 +0000

So: not a bug. Just a reality of calendar reforms.

On 22 June 2012 08:23, Colin L. [email protected] wrote:

this:

puts(“expected = #{expected.to_formatted_s(:rfc822)}
(#{expected.inspect})”)
puts(“found = #{found.to_formatted_s(:rfc822)}
(#{found.inspect})”)

What is the class of found?

Also I don’t think you have told us which versions of ruby and rails
you are using.

Colin