This project is archived and is in readonly mode.

#1255 ✓resolved
Ivan Vega

time.end_of_day not entirely accurate

Reported by Ivan Vega | October 23rd, 2008 @ 01:38 AM | in 2.x

Time.new.end_of_day.usec returns 0, and it should return 999999 instead, IMHO.

The relevant change is on line 210 of activesupport/lib/active_support/core_ext/time/calculations.rb, simply from:


def end_of_day
  change(:hour => 23, :min => 59, :sec => 59)
end

to:


def end_of_day
  change(:hour => 23, :min => 59, :sec => 59, :usec => 999999)
end

I didn't create a patch because I thought the change is so minimal, but I will if you require it.

This is relevant on an application I'm experimenting with because I'm sorting records by a timestamp, and that sorting could be messed up as the order of two records with the same hour/min/sec would be unpredictable.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages