1 package Reaction::UI::ViewPort::Field::Mutable::DateTime;
7 class 'Reaction::UI::ViewPort::Field::Mutable::DateTime',
8 is 'Reaction::UI::ViewPort::Field::DateTime', which {
10 does 'Reaction::UI::ViewPort::Field::Role::Mutable';
13 ( is => 'rw', isa => 'Str', lazy_build => 1, trigger_adopt('value_string') );
15 around value_string => sub {
18 if (@_ && defined($_[0]) && !ref($_[0]) && $_[0] eq ''
19 && !$self->value_is_required) {
23 return $self->$orig(@_);
26 implements adopt_value_string => as {
28 my $value = $self->value_string;
29 my ($epoch) = Time::ParseDate::parsedate($value);
31 my $dt = 'DateTime'->from_epoch( epoch => $epoch );
34 $self->message("Could not parse date or time");
38 around accept_events => sub { ('value_string', shift->(@_)) };
47 Reaction::UI::ViewPort::Field::DateTime
55 Accessor for the string representation of the DateTime object.
57 =head2 value_string_default_format
59 By default it is set to "%F %H:%M:%S".
65 =head2 L<Reaction::UI::ViewPort::Field>
69 See L<Reaction::Class> for authors.
73 See L<Reaction::Class> for the license.