| 1 | package Reaction::UI::ViewPort::Field::Mutable::DateTime; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use Reaction::Class; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use Time::ParseDate; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use DateTime; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | use namespace::clean -except => [ qw(meta) ]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 4 | extends 'Reaction::UI::ViewPort::Field::DateTime'; | |||||||||
| 9 | |||||||||||
| 10 | 4 | with 'Reaction::UI::ViewPort::Field::Role::Mutable::Simple'; | |||||||||
| 11 | 0 | ▶ | sub adopt_value_string { | ||||||||
|
Subroutine
adopt_value_string: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 12 | 0 | my ($self) = @_; | |||||||||
| 13 | 0 | my $value = $self->value_string; | |||||||||
| 14 | 0 | my ($epoch) = Time::ParseDate::parsedate($value); | |||||||||
| 15 | 0 | ▶ | if (defined $epoch) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 0 | my $dt = 'DateTime'->from_epoch( epoch => $epoch ); | |||||||||
| 17 | 0 | $self->value($dt); | |||||||||
| 18 | } else { | ||||||||||
| 19 | 0 | $self->value($self->value_string); | |||||||||
| 20 | } | ||||||||||
| 21 | }; | ||||||||||
| 22 | |||||||||||
| 23 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | 4 | 1; | |||||||||
| 27 | |||||||||||
| 28 | |||||||||||
| 29 | =head1 NAME | ||||||||||
| 30 | |||||||||||
| 31 | Reaction::UI::ViewPort::Field::DateTime | ||||||||||
| 32 | |||||||||||
| 33 | =head1 DESCRIPTION | ||||||||||
| 34 | |||||||||||
| 35 | =head1 METHODS | ||||||||||
| 36 | |||||||||||
| 37 | =head2 value_string | ||||||||||
| 38 | |||||||||||
| 39 | Accessor for the string representation of the DateTime object. | ||||||||||
| 40 | |||||||||||
| 41 | =head2 value_string_default_format | ||||||||||
| 42 | |||||||||||
| 43 | By 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 | |||||||||||
| 53 | See L<Reaction::Class> for authors. | ||||||||||
| 54 | |||||||||||
| 55 | =head1 LICENSE | ||||||||||
| 56 | |||||||||||
| 57 | See L<Reaction::Class> for the license. | ||||||||||
| 58 | |||||||||||
| 59 | =cut | ||||||||||