I'm not a core developer, but I have noticed that you are comparing how
ActiveRecord handles parsing a timestamp with Date.parse.
Try comparing with Time.zone.parse:

> Time.zone.parse('2/2/2')
=> Sat, 02 Feb 0002 00:00:00 LMT -07:52


On Mon, Aug 11, 2014 at 10:14 AM, <[email protected]> wrote:

> Hi Rails Core,
>
> I was wondering how ActiveRecord is parsing dates, as it seems
> counterintuitive to how Ruby does it.
>
> RUBYCONSOLE:> Date.parse("2/2/2")
> => *Sat, 02 Feb 2002*
>
> $ rails g model receipt occurred_at:date
>
> RUBYCONSOLE:> Receipt.create!(occurred_at: "2/2/2")
>
> => #<Receipt id: 1, occurred_at: "*0002-02-02*", created_at: "2014-08-11
> 17:06:18", updated_at: "2014-08-11 17:06:18">
>
> RUBYCONSOLE:> Date.parse("0002-02-02")
> => Thu, 02 Feb 0002
>
>
> What's up here?  I'd like my receipt to be on printer paper, not stone
> tablets.
>
>
> Thanks!
>
> Josh Bourgeois
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to