use base qw/DBIx::Class/;
use DBIx::Class::Carp;
use Try::Tiny;
+use Scalar::Util qw/blessed/;
use namespace::clean;
=head1 NAME
my $method = $parser->can($preferred_method) || sprintf($method_fmt, 'datetime');
return try {
- $parser->$method($value);
+ my $thing = $parser->$method($value);
+ $thing->set_formatter($parser) if blessed $thing;
+ $thing;
}
catch {
$self->throw_exception ("Error while inflating '$value' for $info->{__dbic_colname} on ${self}: $_")
# klunky, but makes older Test::More installs happy
my $starts = $event->starts_at;
-is("$starts", '2006-04-25T22:24:33', 'Correct date/time');
+is("$starts", '2006-04-25 22:24:33', 'Correct date/time');
my $dt_warn_re = qr/DateTime objects.+not supported properly/;
# klunky, but makes older Test::More installs happy
my $createo = $event->created_on;
-is("$createo", '2006-06-22T21:00:05', 'Correct date/time');
+is("$createo", '2006-06-22 21:00:05', 'Correct date/time');
my $created_cron = $created->created_on;
## varchar field using inflate_date => 1
my $varchar_date = $event->varchar_date;
-is("$varchar_date", '2006-07-23T00:00:00', 'Correct date/time');
+is("$varchar_date", '2006-07-23 00:00:00', 'Correct date/time');
## varchar field using inflate_datetime => 1
my $varchar_datetime = $event->varchar_datetime;
-is("$varchar_datetime", '2006-05-22T19:05:07', 'Correct date/time');
+is("$varchar_datetime", '2006-05-22 19:05:07', 'Correct date/time');
## skip inflation field
my $skip_inflation = $event->skip_inflation;
isa_ok($loaded_event->starts_at, 'DateTime', 'DateTime returned');
$starts_at = $loaded_event->starts_at;
- is("$starts_at", '2007-12-31T00:00:00', 'Loaded correct date/time using timezone');
+ is("$starts_at", '2007-12-31 00:00:00', 'Loaded correct date/time using timezone');
is($starts_at->time_zone->name, 'America/Chicago', 'Correct timezone');
isa_ok($loaded_event->created_on, 'DateTime', 'DateTime returned');
$created_on = $loaded_event->created_on;
- is("$created_on", '2006-01-31T12:34:56', 'Loaded correct timestamp using timezone');
+ is("$created_on", '2006-01-31 12:34:56', 'Loaded correct timestamp using timezone');
is($created_on->time_zone->name, 'America/Chicago', 'Correct timezone');
# Test floating timezone warning