From e8e92c7264511f19e5cf48006a55a02358f838fd Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Wed, 20 Feb 2013 12:49:20 +0400 Subject: fix time_tag helper and update tests to not rely on dynamically generated values Before `time_tag Date.today` will return ``. This commit fixes time_tag helper to use RFC-3339 full-date format (Y-m-d) in datetime attribute. --- actionpack/lib/action_view/helpers/date_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index a989966613..8df27611e0 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -651,7 +651,7 @@ module ActionView options = args.extract_options! format = options.delete(:format) || :long content = args.first || I18n.l(date_or_time, :format => format) - datetime = date_or_time.acts_like?(:time) ? date_or_time.xmlschema : date_or_time.rfc3339 + datetime = date_or_time.acts_like?(:time) ? date_or_time.xmlschema : date_or_time.iso8601 content_tag(:time, content, options.reverse_merge(:datetime => datetime), &block) end -- cgit v1.2.3 From dc142f9cd4d6341df28350ef4065c40f21e1f586 Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Wed, 20 Feb 2013 15:06:01 +0400 Subject: document setting custom datetime attribute for time_tag helper --- actionpack/lib/action_view/helpers/date_helper.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 8df27611e0..d3953c26b7 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -642,6 +642,8 @@ module ActionView # # time_tag Date.today, pubdate: true # => # + # time_tag Date.today, datetime: Date.today.strftime('%G-W%V') # => + # # # <%= time_tag Time.now do %> # Right now -- cgit v1.2.3