I have a problem that I cannot understand. I am trying to format the date using a custom format that I defined in my en.yml file:
en:
hello: "Hello world"
time:
formats:
history_table: "%m/%d/%Y %I:%M:%S %p %Z"
This is called with the help of the 'l' helper:
l version.created_at, :format => :history_table
For some reason, this displays AM / PM in lowercase rather than upper case, as it should be with% p.
I played a little in the console, and it looks like this is the difference in behavior between the localization function and strftime:
ruby-1.9.2-p180 :043 > I18n.l user.updated_at, :format => "%m/%d/%Y %I:%M:%S %p %Z"
=> "03/23/2011 01:52:16 am UTC"
ruby-1.9.2-p180 :044 > user.updated_at.strftime("%m/%d/%Y %I:%M:%S %p %Z")
=> "03/23/2011 01:52:16 AM UTC"
Am I doing something wrong? This is mistake? Any guidance is greatly appreciated because my forehead hurts from hitting it against the wall.
:
(ish).
, % p % P.
https://github.com/rails/rails/blob/master/activesupport/lib/active_support/locale/en.yml
en.yml, . , Rails .