Reaction::UI::ViewPort::Field::Mutable::DateTime - Reaction::UI::ViewPort::Field::Mutable::DateTime documentation


Reaction documentation Contained in the Reaction distribution.

Index


Code Index:

NAME

Top

Reaction::UI::ViewPort::Field::DateTime

DESCRIPTION

Top

METHODS

Top

value_string

Accessor for the string representation of the DateTime object.

value_string_default_format

By default it is set to "%F %H:%M:%S".

SEE ALSO

Top

DateTime

Reaction::UI::ViewPort::Field

AUTHORS

Top

See Reaction::Class for authors.

LICENSE

Top

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;