fix matching passwords stuff
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Field / Mutable / DateTime.pm
CommitLineData
ddccc6a2 1package Reaction::UI::ViewPort::Field::Mutable::DateTime;
2
3use Reaction::Class;
4use Time::ParseDate;
5use DateTime;
6
81393881 7use namespace::clean -except => [ qw(meta) ];
8extends 'Reaction::UI::ViewPort::Field::DateTime';
9
10with 'Reaction::UI::ViewPort::Field::Role::Mutable::Simple';
11sub adopt_value_string {
12 my ($self) = @_;
13 my $value = $self->value_string;
14 my ($epoch) = Time::ParseDate::parsedate($value);
15 if (defined $epoch) {
16 my $dt = 'DateTime'->from_epoch( epoch => $epoch );
17 $self->value($dt);
18 } else {
19 $self->value($self->value_string);
20 }
ddccc6a2 21};
22
81393881 23__PACKAGE__->meta->make_immutable;
24
25
ddccc6a2 261;
27
28
29=head1 NAME
30
31Reaction::UI::ViewPort::Field::DateTime
32
33=head1 DESCRIPTION
34
35=head1 METHODS
36
37=head2 value_string
38
39Accessor for the string representation of the DateTime object.
40
41=head2 value_string_default_format
42
43By default it is set to "%F %H:%M:%S".
44
45=head1 SEE ALSO
46
47=head2 L<DateTime>
48
49=head2 L<Reaction::UI::ViewPort::Field>
50
51=head1 AUTHORS
52
53See L<Reaction::Class> for authors.
54
55=head1 LICENSE
56
57See L<Reaction::Class> for the license.
58
59=cut