aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/date_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/lib/action_view/helpers/date_helper.rb')
-rw-r--r--actionview/lib/action_view/helpers/date_helper.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/date_helper.rb b/actionview/lib/action_view/helpers/date_helper.rb
index 312e41ee48..c69e4cc77e 100644
--- a/actionview/lib/action_view/helpers/date_helper.rb
+++ b/actionview/lib/action_view/helpers/date_helper.rb
@@ -845,7 +845,15 @@ module ActionView
private
%w( sec min hour day month year ).each do |method|
define_method(method) do
- @datetime.kind_of?(Numeric) ? @datetime : @datetime.send(method) if @datetime
+ if @datetime
+ if @datetime.kind_of?(Hash)
+ @datetime[method.to_sym]
+ elsif @datetime.kind_of?(Numeric)
+ @datetime
+ else
+ @datetime.send(method)
+ end
+ end
end
end