Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Time#end_of_day to get 23:59:59 of that day [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5495 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 79c309e43ba8832a8665fdec26e32062e5b2b830 1 parent da3eae4
@dhh dhh authored
View
2  activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Added Time#end_of_day to get 23:59:59 of that day [DHH]
+
* Don't quote hash keys in Hash#to_json if they're valid JavaScript identifiers. Disable this with ActiveSupport::JSON.unquote_hash_key_identifiers = false if you need strict JSON compliance. [Sam Stephenson]
* Lazily load the Unicode Database in the UTF-8 Handler [Rick Olson]
View
5 activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -149,6 +149,11 @@ def beginning_of_day
alias :at_midnight :beginning_of_day
alias :at_beginning_of_day :beginning_of_day
+ # Returns a new Time representing the end of the day (23:59:59)
+ def end_of_day
+ change(:hour => 23, :minute => 59, :sec => 59)
+ end
+
# Returns a new Time representing the start of the month (1st of the month, 0:00)
def beginning_of_month
#self - ((self.mday-1).days + self.seconds_since_midnight)
Please sign in to comment.
Something went wrong with that request. Please try again.