|
#!/usr/bin/perl
my $t = Time::Piece->from_mysql_datetime( '2012-02-11 05:45:37' );
isa_ok( $t , 'Time::Piece' );
$t = Time::Piece->from_mysql_date( '2012-02-11' );
isa_ok( $t , 'Time::Piece' );
my @null = qw/ 0000-00-00 1000-01-01 9999-12-31 / ;
for my $d ( @null ) {
ok ! defined Time::Piece->from_mysql_date( $d ), "$d is not in range" ;
}
ok ! defined Time::Piece->from_mysql_date( undef ), "null is not in range" ;
my @bad = qw/ 2001-00-00 2001-00-31 2001-02-00 2001-04-00 / ;
my @ugly = qw/ 2001-02-31 2001-04-31 2001-11-31 / ;
|