| HTML-Shakan documentation | Contained in the HTML-Shakan distribution. |
HTML::Shakan::Inflator::DateTime - inflate field value to DateTime instance
Tokuhiro Matsuno
| HTML-Shakan documentation | Contained in the HTML-Shakan distribution. |
package HTML::Shakan::Inflator::DateTime; use Any::Moose; use DateTime; use DateTime::Format::HTTP; has 'time_zone' => ( is => 'ro', isa => 'Str', ); sub inflate { my ($self, $val) = @_; my $dt = DateTime::Format::HTTP->parse_datetime($val); if (my $tz = $self->time_zone) { $dt->set_time_zone($tz); } return $dt; } no Any::Moose; __PACKAGE__->meta->make_immutable; __END__