Date.new.to_time.to_i

If you look at the classes returned, Date.new.to_time returns a DateTime, while Date.today.to_time returns a Time

Date.new.to_time.class --> DateTime
Date.today.to_time.class --> Time

Not sure why that is the case, but obviously DateTime doesn't have a to_i method.

Simon

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