On Jun 19, 12:45 am, "Simon Macneall" <[email protected]> wrote:
> Not sure why that is the case, but obviously DateTime doesn't have a to_i  
> method.

Date::new() returns Julian day 0, which is Mon, 01 Jan -4712

to_time() is a CoreExtensions method which uses Time::utc_time() ->
Time::time_with_datetime_fallback() from CoreExtensions to generate
the Time object. From the documentation:

Returns a new Time if requested year can be accommodated by Ruby‘s
Time class (i.e., if year is within either 1970..2038 or 1902..2038,
depending on system architecture); otherwise returns a DateTime

Because the year is out of range, you'll get a DateTime back, which
you can't call to_i on.

This is actually quite silly, when you think about it.

-Matt


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to