1 package SL::DB::Helpers::AttrDate;
10 my $attribute = shift;
14 *{ $package . '::' . $attribute . '_as_date' } = sub {
15 my ($self, $string) = @_;
19 my ($yy, $mm, $dd) = $::locale->parse_date(\%::myconfig, $string);
20 $self->$attribute(DateTime->new(year => $yy, month => $mm, day => $dd));
22 $self->$attribute(undef);
26 return $self->$attribute
27 ? $::locale->reformat_date(
28 { dateformat => 'yy-mm-dd' },
29 $self->${attribute}->ymd,
30 $::myconfig{dateformat}