I thought I must be going blind as in gmail in FF the two lines above
look identical, it was only when I copied and pasted into my editor in
order to do a compare that I realised the first on is %<upper case i>
and the second is %<lower case L>. I don't see lower case L in the
docs for strftime, which may explain the problem.
If you scroll down towards the bottom, there's a very large table that
contains the formats. I was trying to follow the one for 12-hour
without the leading number.
I guess this means I have to use gsub..
Interestingly, in irb:
irb(main):006:0> Time.now.strftime("%I:%M %p") # upper case i
=> "03:39 PM"
irb(main):007:0> Time.now.strftime("%l:%M %p") # lower case l
=> " 3:39 PM"
What class is your schedule.date_scheduled? (use
schedule.date_scheduled.class to find out)
Could it be that something on the way to the browser chokes on the leading whitespace? Maybe try the code in script/console, and continue adding stuff around your strftime(...) until you find the culprit.
I had to place it in another place because I forgot I was looking for a
conditional. The %l does not work and it may just be ruby version
related. I'm sure that 1.9 came out with new time features and maybe
that's part of them..
ripple:~ hassan$ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
ripple:~ hassan$ irb
irb(main):001:0> Time.now.strftime("%I:%M %p") # u/c I as in India
=> "08:46 AM"
irb(main):002:0> Time.now.strftime("%l:%M %p") # l/c l as in Lima
=> " 8:46 AM"
irb(main):003:0>