On Thu, Jun 06, 2002 at 05:08:56PM -0400, Sam Tregar wrote: > > Suppose you have a model object for a concert which includes a date. On > > one page, the designers want to dipslay the date in a verbose way with > > the month spelled out, but on another they want it abbreviated and fixed > > length so that dates line up nicely. Would you put that formatting in > > the controller? > In the script: > > $template->param(long_date => $long_date, > short_date => $short_date); > In the template: > > The long date: <tmpl_var long_date> <br> > The short date: <tmpl_var short_date>
Can I vote for "yick" on this? A designer should never have to come to a programmer just to change the formatting of a date. I'm a huge fan of passing Date::Simple objects, which can then take a strftime format string: [% date.format("%d %b %y") %] [% date.format("%Y-%m-%d") %] Tony