[Catalyst] Changing format of date field

Ian Docherty catalyst at iandocherty.com
Tue Jan 7 09:41:07 GMT 2014


I suggested that you extend DBIx::Class::InflateColumn to create
DBIx::Class::InflateColumn::MyDateTime to give you the result you need.

However, I would state that although I have shown you how to do this,
personally I would keep decisions about how to display data where it
belongs, in the view, and stay with the object.dmy() which makes it quite
clear your intent, rather than doing it 'at a distance' in the model.

Kind Regards
icydee


On 7 January 2014 09:32, Adam Witney <awitney at sgul.ac.uk> wrote:

>
> Thanks for your reply Ian,
>
> So you mean copy DBIx::Class::InflateColumn::DateTime under my lib/
> directory and build into the DateTime formatter option?
>
>
> On 6. 1. 2014 15:42, Ian Docherty wrote:
>
>> DateTime has an option to change the default stringification with a
>> 'formatter' option.
>>
>> Also DBIx::Class::InflateColumn::DateTime is a convenience method, you
>> could choose to use the DBIx::Class::InflateColumn yourself and combine
>> this with the DateTime formatter option to give you the result you are
>> looking for.
>>
>> icydee
>>
>>
>> On 6 January 2014 15:18, Adam Witney <awitney at sgul.ac.uk
>> <mailto:awitney at sgul.ac.uk>> wrote:
>>
>>     Hi,
>>
>>     I have a date field in a DBIx::Class Result class using
>>     InflateColumn::DateTime. When I pass this through a Catalyst/TT
>>     application, the date is presented in YYYY-MM-DD format.
>>
>>     I can modify this to DD/MM/YYYY in my TT template with
>>     object.dmy('/'), but I would prefer to change the default DateTime
>>     stringification, however I am not quite sure where or how to do this?
>>
>>     Any ideas greatly appreciated.
>>
>>     Thanks
>>
>>     Adam
>>
>>     _________________________________________________
>>     List: Catalyst at lists.scsys.co.uk <mailto:Catalyst at lists.scsys.co.uk>
>>     Listinfo:
>>     http://lists.scsys.co.uk/cgi-__bin/mailman/listinfo/catalyst
>>     <http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst>
>>     Searchable archive:
>>     http://www.mail-archive.com/__catalyst@lists.scsys.co.uk/
>>
>>     <http://www.mail-archive.com/catalyst@lists.scsys.co.uk/>
>>     Dev site: http://dev.catalyst.perl.org/
>>
>>
>>
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive: http://www.mail-archive.com/
>> catalyst at lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>>
>>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/
> catalyst at lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20140107/39048=
707/attachment.htm


More information about the Catalyst mailing list