From 3a696dd290f4cc6bd560c0b5a8d2a4e33afa178c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 18 Sep 2007 06:38:28 +0000 Subject: Deprecation: remove deprecated :mday option from Time, Date, and DateTime#change. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7508 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/core_ext/date/calculations.rb | 2 +- .../lib/active_support/core_ext/date_time/calculations.rb | 2 +- activesupport/lib/active_support/core_ext/time/calculations.rb | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'activesupport/lib/active_support/core_ext') diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb index 37f5d3b544..df35410b3e 100644 --- a/activesupport/lib/active_support/core_ext/date/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date/calculations.rb @@ -87,7 +87,7 @@ module ActiveSupport #:nodoc: ::Date.new( options[:year] || self.year, options[:month] || self.month, - options[:day] || options[:mday] || self.day # mday is deprecated + options[:day] || self.day ) end diff --git a/activesupport/lib/active_support/core_ext/date_time/calculations.rb b/activesupport/lib/active_support/core_ext/date_time/calculations.rb index e16ad55fbd..4ec75288ca 100644 --- a/activesupport/lib/active_support/core_ext/date_time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date_time/calculations.rb @@ -18,7 +18,7 @@ module ActiveSupport #:nodoc: ::DateTime.civil( options[:year] || self.year, options[:month] || self.month, - options[:day] || options[:mday] || self.day, # mday is deprecated + options[:day] || self.day, options[:hour] || self.hour, options[:min] || (options[:hour] ? 0 : self.min), options[:sec] || ((options[:hour] || options[:min]) ? 0 : self.sec), diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index e5302f990b..b1ad5a9e99 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -63,7 +63,7 @@ module ActiveSupport #:nodoc: self.utc? ? :utc_time : :local_time, options[:year] || self.year, options[:month] || self.month, - options[:day] || options[:mday] || self.day, # mday is deprecated + options[:day] || self.day, options[:hour] || self.hour, options[:min] || (options[:hour] ? 0 : self.min), options[:sec] || ((options[:hour] || options[:min]) ? 0 : self.sec), @@ -121,7 +121,7 @@ module ActiveSupport #:nodoc: max = ::Time.days_in_month(month, year) mday = max if mday > max - change(:year => year, :month => month, :mday => mday) + change(:year => year, :month => month, :day => mday) end # Returns a new Time representing the time a number of specified years ago @@ -184,7 +184,7 @@ module ActiveSupport #:nodoc: # 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(:mday => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0) + change(:day => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0) end alias :at_beginning_of_month :beginning_of_month @@ -192,7 +192,7 @@ module ActiveSupport #:nodoc: def end_of_month #self - ((self.mday-1).days + self.seconds_since_midnight) last_day = ::Time.days_in_month( self.month, self.year ) - change(:mday => last_day,:hour => 0, :min => 0, :sec => 0, :usec => 0) + change(:day => last_day,:hour => 0, :min => 0, :sec => 0, :usec => 0) end alias :at_end_of_month :end_of_month @@ -204,7 +204,7 @@ module ActiveSupport #:nodoc: # Returns a new Time representing the start of the year (1st of january, 0:00) def beginning_of_year - change(:month => 1,:mday => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0) + change(:month => 1,:day => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0) end alias :at_beginning_of_year :beginning_of_year -- cgit v1.2.3