Adam Herzog wrote:
I think InflateColumn::DateTime probably has to be _before_ Core:
__PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);

Thanks, that did the trick.
Note also that PK::Auto is included in 'Core', so you don't have to specify it.

Noted (and corrected).
On reflection though, maybe InflateColumn is not the correct method for what I really want - to globally reformat date fields to EU format.

If you're certain you'll only want an EU formatted date, you can use DBIx::Class::InflateColumn in your resultset and add the code to inflate to whatever you'd like. Check the InflateColumn docs for an example.

Currently doing: ( join '.', $hits->date->day, $hits->date->month, $hits->date->year ) in the controllers - repetitive and probably a less desirable tmtowtdi. In fact it's probably easier to join '.', reverse split '-', $hits->date without using InflateColumns::DateTime.
I generally prefer receiving the DateTime object, though, since my formatting is usually dependent on what I'm doing with the data. If you're using something like Catalyst, I'd pass the DateTime object down to the view, and let it decide how to format it.
Sounds like something for a TT snippet - but how do I call the DateTime object in the template (yes I'm using Cat)?
--
Richard Jones



**********************************************************************
This message  may  contain  confidential  and  privileged information.
If you are not  the intended  recipient please  accept our  apologies.
Please do not disclose, copy or distribute  information in this e-mail
or take any  action in reliance on its  contents: to do so is strictly
prohibited and may be unlawful. Please inform us that this message has
gone  astray  before  deleting it.  Thank  you for  your co-operation.

NHSmail is used daily by over 100,000 staff in the NHS. Over a million
messages  are sent every day by the system.  To find  out why more and
more NHS personnel are  switching to  this NHS  Connecting  for Health
system please visit www.connectingforhealth.nhs.uk/nhsmail
**********************************************************************


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to