I’m a newbie so please have pity if the answer is obvioius
I wrote a date formatter. It works as expected in irb, but if i try to
use
it to format a date for display as the value of an input (type=text)
field,
it truncates unexpectedly.
I have a helper that is doing the same thing. Firstly, your value=
attribute doesn’t have “” around the actual value data (the date).
btw, I’d make sure you have an object that can understand date methods
before throwing them around, if you gave a string to your function it
wouldn’t act very happy. And you might want to use
Date::ABBR_MONTHNAMES, which already has the abbreviations, and will not
need to be instantiated every time you use that method.
-Matt B
def d(unformatted)
if (unformatted.kind_of?(Date) || unformatted.kind_of?(Time))
“#{Date::ABBR_MONTHNAMES[unformatted.mon]} #{unformatted.mday},
#{unformatted.year}”
end
end