aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-09-20 00:51:28 +0900
committerkennyj <kennyj@gmail.com>2012-09-20 00:51:28 +0900
commit105cb3d9e3cd523c00262826cd541cb10e05aa0a (patch)
treea9cf1b8fd227a6328f6963e115608d5dc803feb3 /activesupport/lib
parentbf4c8fe69447c489dcae5e828114651b2213e210 (diff)
downloadrails-105cb3d9e3cd523c00262826cd541cb10e05aa0a.tar.gz
rails-105cb3d9e3cd523c00262826cd541cb10e05aa0a.tar.bz2
rails-105cb3d9e3cd523c00262826cd541cb10e05aa0a.zip
Fix #6962. AS::TimeWithZone#strftime responds incorrectly to %:z and %::z format strings.
Diffstat (limited to 'activesupport/lib')
-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 93c2d614f5..8c8f998f21 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -168,7 +168,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