fixed vestigial $ctx access
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Field / DateTime.pm
CommitLineData
7adfd53f 1package Reaction::UI::ViewPort::Field::DateTime;
2
1734a92a 3use Scalar::Util 'blessed';
7adfd53f 4use Reaction::Class;
586b1b0d 5use Reaction::Types::DateTime ();
ddccc6a2 6use aliased 'Reaction::UI::ViewPort::Field';
7adfd53f 7
81393881 8use namespace::clean -except => [ qw(meta) ];
9extends Field;
6ab43711 10
6ab43711 11
81393881 12has '+value' => (isa => Reaction::Types::DateTime::DateTime());
6ab43711 13
81393881 14has value_string_default_format => (
15 isa => 'Str', is => 'rw', required => 1, default => sub { "%F %H:%M:%S" }
16);
17
18around _value_string_from_value => sub {
19 my $orig = shift;
20 my $self = shift;
21 my $format = $self->value_string_default_format;
22 return $self->$orig(@_)->strftime($format);
7adfd53f 23};
24
81393881 25__PACKAGE__->meta->make_immutable;
26
27
6ab43711 281;