| Reaction documentation | Contained in the Reaction distribution. |
Reaction::UI::ViewPort::Field::DateTime
Accessor for the string representation of the DateTime object.
By default it is set to "%F %H:%M:%S".
See Reaction::Class for authors.
See Reaction::Class for the license.
| Reaction documentation | Contained in the Reaction distribution. |
package Reaction::UI::ViewPort::Field::Mutable::DateTime; use Reaction::Class; use Time::ParseDate; use DateTime; use namespace::clean -except => [ qw(meta) ]; extends 'Reaction::UI::ViewPort::Field::DateTime'; with 'Reaction::UI::ViewPort::Field::Role::Mutable::Simple'; sub adopt_value_string { my ($self) = @_; my $value = $self->value_string; my ($epoch) = Time::ParseDate::parsedate($value); if (defined $epoch) { my $dt = 'DateTime'->from_epoch( epoch => $epoch ); $self->value($dt); } else { $self->value($self->value_string); } }; __PACKAGE__->meta->make_immutable; 1;