[Catalyst] Setting time zone and locale on dates.

Chisel Wright chisel at herlpacker.co.uk
Mon May 21 22:58:34 GMT 2007


On Mon, May 21, 2007 at 01:54:54PM -0700, Bill Moseley wrote:
> What do you do?

I inflate all my dates to DateTime objects:

  foreach my $datecol (qw/created/) {
    __PACKAGE__->inflate_column($datecol, {
      inflate => sub { DateTime::Format::Pg->parse_datetime(shift); },
      deflate => sub { DateTime::Format::Pg->format_datetime(shift); },
    });
  }

Then to display dates, I pass them through my somewhat scruffy looking
nicedate() TT macro:

http://svn.berlios.de/svnroot/repos/parley/trunk/root/base/shared/useful_tt_stuff

There might be nicer ways, but the overall method seems to be working
really well for me so far.

I'm not sure if/how locale would tie into this though.

Chisel
-- 
Chisel Wright
e: chisel at herlpacker.co.uk
w: http://www.herlpacker.co.uk/

  SELECT message FROM signatures ORDER BY RANDOM() LIMIT 1;



More information about the Catalyst mailing list