aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorChris Kalafarski <chris@farski.com>2011-03-13 20:22:32 -0400
committerChris Kalafarski <chris@farski.com>2011-03-13 20:22:32 -0400
commit377bd69e295086f72c623e6323698eeb1d8a0a34 (patch)
treedb540367e776e7d9cdde4d1d4fd0cc0400d97a15 /activesupport/lib/active_support/core_ext
parentdfa9e2811320d44ff140f115a4f7a3abb41bda16 (diff)
downloadrails-377bd69e295086f72c623e6323698eeb1d8a0a34.tar.gz
rails-377bd69e295086f72c623e6323698eeb1d8a0a34.tar.bz2
rails-377bd69e295086f72c623e6323698eeb1d8a0a34.zip
Removed some redundant Time#change time options from beginning_of_ methods in Date and Time
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb6
2 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index 724e076407..236055d77a 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -206,7 +206,7 @@ class Date
# Returns a new ; DateTime objects will have time set to 0:00DateTime representing the start of the month (1st of the month; DateTime objects will have time set to 0:00)
def beginning_of_month
- self.acts_like?(:time) ? change(:day => 1,:hour => 0, :min => 0, :sec => 0) : change(:day => 1)
+ self.acts_like?(:time) ? change(:day => 1, :hour => 0) : change(:day => 1)
end
alias :at_beginning_of_month :beginning_of_month
@@ -231,13 +231,13 @@ class Date
# Returns a new Date/DateTime representing the start of the year (1st of january; DateTime objects will have time set to 0:00)
def beginning_of_year
- self.acts_like?(:time) ? change(:month => 1, :day => 1, :hour => 0, :min => 0, :sec => 0) : change(:month => 1, :day => 1)
+ self.acts_like?(:time) ? change(:month => 1, :day => 1, :hour => 0) : change(:month => 1, :day => 1)
end
alias :at_beginning_of_year :beginning_of_year
# Returns a new Time representing the end of the year (31st of december; DateTime objects will have time set to 23:59:59)
def end_of_year
- self.acts_like?(:time) ? change(:month => 12,:day => 31,:hour => 23, :min => 59, :sec => 59) : change(:month => 12, :day => 31)
+ self.acts_like?(:time) ? change(:month => 12, :day => 31, :hour => 23, :min => 59, :sec => 59) : change(:month => 12, :day => 31)
end
alias :at_end_of_year :end_of_year
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index 7e134db118..dcac17536a 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -187,7 +187,7 @@ class Time
# Returns a new Time representing the start of the day (0:00)
def beginning_of_day
#(self - seconds_since_midnight).change(:usec => 0)
- change(:hour => 0, :min => 0, :sec => 0, :usec => 0)
+ change(:hour => 0)
end
alias :midnight :beginning_of_day
alias :at_midnight :beginning_of_day
@@ -201,7 +201,7 @@ class Time
# 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)
- change(:day => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0)
+ change(:day => 1, :hour => 0)
end
alias :at_beginning_of_month :beginning_of_month
@@ -227,7 +227,7 @@ class Time
# Returns a new Time representing the start of the year (1st of january, 0:00)
def beginning_of_year
- change(:month => 1, :day => 1, :hour => 0, :min => 0, :sec => 0, :usec => 0)
+ change(:month => 1, :day => 1, :hour => 0)
end
alias :at_beginning_of_year :beginning_of_year