Hi, On 2014-04-17 12:51, Adam Witney wrote: > > Hi, > > I have a Catalyst/DBIx::Class application but I am having trouble with > datetime inflation. > > I have a PostgreSQL database with datestyle "SQL, DMY" and timezone > "GB". The table has a field with datatype "timestamp without > timezone", so my dates look like "15/04/2014 13:41:50" in the database. > > My Result class loads the TimeStamp component, but when I try to > render the variable in my TT view I get a long error including: > > "The 'month' parameter ("15") to DateTime::new did not pass the 'an > integer between 1 and 12' callback" > > I assume it is trying to inflate the field as MDY rather than DMY as > is set in my database? > > I can get the string version of the date by setting the column to > "'inflate_datetime' => 0", but I would like to get the DateTime object > back. > > I am having trouble working out how and where I tell my application of > the database datestyle format, could someone provide any advice? I guess you're missing on_connect_do => 'datetime_setup' as hidden in the docs here: https://metacpan.org/pod/DBIx::Class::Storage::DBI#datetime_setup
This will run the appropriate sql required for each supported rdbms to make datetime columns return the format inflatecolumn::datetime expects. > > Thanks > > Adam Best regards, Alex > > > > _______________________________________________ > List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class > IRC: irc.perl.org#dbix-class > SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ > Searchable Archive: > http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien Handelsgericht Wien, FN 79340b *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* Notice: This e-mail contains information that is confidential and may be privileged. If you are not the intended recipient, please notify the sender and then delete this e-mail immediately. *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk