Jifty/Web/Form/Field/DateTime.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 27 CC 3 SCAR 18.4
CC
3
Cov
0%
canonicalize_value
12.0
classes
2.0
BEGIN
2.0
CRAP 6.3
1 use warnings;
2 use strict;
3
4 package Jifty::Web::Form::Field::DateTime;
5  
6 use base qw/Jifty::Web::Form::Field/;
7  
8 =head1 NAME
9  
10 Jifty::Web::Form::Field::DateTime - Add date pickers to your forms
11  
12 =head1 METHODS
13  
14 =head2 classes
15  
16 Output date fields with the class 'date'
17  
18 =cut
19  
20 sub classes {
21 my $self = shift;
22 return join(' ', 'datetime', ($self->SUPER::classes));
23 }
24  
25 =head2 canonicalize_value
26  
27 If the value is a DateTime, return nothing if the epoch is 0
28  
29 =cut
30  
31 sub canonicalize_value {
32 my $self = shift;
33 my $value = $self->current_value;
34  
35 if (UNIVERSAL::isa($value, 'DateTime')) {
36 return unless $value->epoch;
37 }
38  
39 return $value;
40 }
41  
42 1;