I have isolated what appears to be a bug in the Rails extensions to DateTime, but I don''t know where to report it. I have a standalone file to demonstrate the bug, but 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? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 21 June 2012 17:36, Fearless Fool <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have isolated what appears to be a bug in the Rails extensions to > DateTime, but I don''t know where to report it. > > I have a standalone file to demonstrate the bug, but 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?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 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> 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 https://gist.github.com/2967023 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 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''ve created: https://github.com/rails/rails/issues/6814 ... 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 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 21 June 2012 18:05, Fearless Fool <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:>> 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 https://gist.github.com/2967023 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})")What is the class of found? Colin> > => > > 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 > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 22 June 2012 08:23, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 21 June 2012 18:05, Fearless Fool <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> 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 https://gist.github.com/2967023 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})") > > 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 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law 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.1But this is all now moot: I posted this as a Rails issue: https://github.com/rails/rails/issues/6814 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. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.