aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2016-06-02 11:44:20 -0400
committerSean Griffin <sean@seantheprogrammer.com>2016-06-02 11:47:22 -0400
commit2c5a8ba6f6e2e9c9d3ff2f2b5b36fb50e8a34b8b (patch)
treea6c110351897ed92548345c39137872d83da8dac /activesupport/lib
parentc587b636648394e33292ba8ba47d22bdad7446c3 (diff)
downloadrails-2c5a8ba6f6e2e9c9d3ff2f2b5b36fb50e8a34b8b.tar.gz
rails-2c5a8ba6f6e2e9c9d3ff2f2b5b36fb50e8a34b8b.tar.bz2
rails-2c5a8ba6f6e2e9c9d3ff2f2b5b36fb50e8a34b8b.zip
Don't blank pad day of the month when formatting dates
We are currently using `%e` which adds a space before the result if the digit is a single number. This leads to strings like `February 2, 2016` which is undesireable. I've opted to replace with 0 padding instead of removing the padding entirely, to preserve compatibility for those relying on the fact that the width is constant, and to be consistent with time formatting. Fixes #25251.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/date/conversions.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb
index 9a6d7bb415..6e3b4a89ce 100644
--- a/activesupport/lib/active_support/core_ext/date/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date/conversions.rb
@@ -5,15 +5,15 @@ require 'active_support/core_ext/module/remove_method'
class Date
DATE_FORMATS = {
- :short => '%e %b',
- :long => '%B %e, %Y',
+ :short => '%d %b',
+ :long => '%B %d, %Y',
:db => '%Y-%m-%d',
:number => '%Y%m%d',
:long_ordinal => lambda { |date|
day_format = ActiveSupport::Inflector.ordinalize(date.day)
date.strftime("%B #{day_format}, %Y") # => "April 25th, 2007"
},
- :rfc822 => '%e %b %Y',
+ :rfc822 => '%d %b %Y',
:iso8601 => lambda { |date| date.iso8601 }
}