aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2014-05-11 16:00:55 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2014-05-11 16:00:55 +0100
commit7dce1e6d98f78d0cce963456f226811c22bb645d (patch)
treed613c225849da4bf91ee87c30d17815fc6e89eb5 /activesupport/lib
parent0e909cd3078bab352eb741426024334afe0d6820 (diff)
downloadrails-7dce1e6d98f78d0cce963456f226811c22bb645d.tar.gz
rails-7dce1e6d98f78d0cce963456f226811c22bb645d.tar.bz2
rails-7dce1e6d98f78d0cce963456f226811c22bb645d.zip
Tidy up implementation of #15010
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 4c4c055252..72efb09fbe 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -291,16 +291,10 @@ module ActiveSupport
parts = Date._parse(str, false)
return if parts.empty?
- default_mday = if parts[:year] || parts[:mon]
- 1
- else
- now.day
- end
-
time = Time.new(
parts.fetch(:year, now.year),
parts.fetch(:mon, now.month),
- parts.fetch(:mday, default_mday),
+ parts.fetch(:mday, parts[:year] || parts[:mon] ? 1 : now.day),
parts.fetch(:hour, 0),
parts.fetch(:min, 0),
parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0),