[Dbix-class] Question about handling of undefined times with DBIx::Class::InflateColumn::DateTime

Jonathan Rockway jon at jrock.us
Fri Feb 22 22:18:10 GMT 2008


* On Fri, Feb 22 2008, James Munson wrote:
> I know this has been touched on before a few years ago, but I can't seem to
> track down any fix or 'official workarounds'.
> The problem is that MySQL's default dates are all 0s, and DateTime has no means
> of representing them(that I can see).
>
> This leads to the error of
>
> undef error - The 'month'  parameter ("00")
>  to DateTime::new did not pass the 'is between 1 and 12' callback at /usr/local
> /share/perl/5.8.7/DateTime/Format/Builder/Parser/Regex.pm line 135
>
> There is a closed ticket on the issue at http://rt.cpan.org/Public/Bug/
> Display.html?id=7589 for more info, but short of changing your database I can't
> really find a clean solution to the problem. He mentioned doing a regexp check
> before using DateTime, but with InflateColumn I'm not sure if I even could do
> that if I wanted to. Does anyone have any good workarounds for this problem?

I'm pretty sure there's some code floating around that converts the
0000-00-00 dates to "undef" during inflation.  Check the archives.

Regards,
Jonathan Rockway



More information about the DBIx-Class mailing list