aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/time_with_zone.rb
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-09-20 00:51:28 +0900
committerkennyj <kennyj@gmail.com>2012-09-20 22:04:52 +0900
commit4e715e33aff6274267446d8dcb63da7f60c683b6 (patch)
tree9dd19d48ba085c91086ec0f14be41e323e67544b /activesupport/lib/active_support/time_with_zone.rb
parentc41f9c1bd5346753dacd1caaf1fd69e09f975c90 (diff)
downloadrails-4e715e33aff6274267446d8dcb63da7f60c683b6.tar.gz
rails-4e715e33aff6274267446d8dcb63da7f60c683b6.tar.bz2
rails-4e715e33aff6274267446d8dcb63da7f60c683b6.zip
Fix #6962. AS::TimeWithZone#strftime responds incorrectly to %:z and %::z format strings.
Diffstat (limited to 'activesupport/lib/active_support/time_with_zone.rb')
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index d3adf671a0..59da6bc760 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -177,7 +177,10 @@ module ActiveSupport
# Replaces <tt>%Z</tt> and <tt>%z</tt> directives with +zone+ and +formatted_offset+, respectively, before passing to
# Time#strftime, so that zone information is correct
def strftime(format)
- format = format.gsub('%Z', zone).gsub('%z', formatted_offset(false))
+ format = format.gsub('%Z', zone)
+ .gsub('%z', formatted_offset(false))
+ .gsub('%:z', formatted_offset(true))
+ .gsub('%::z', formatted_offset(true) + ":00")
time.strftime(format)
end