File Coverage

blib/lib/Rose/HTML/Form/Field/DateTime/StartDate.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1              
2             use strict;
3 2     2   802  
  2         4  
  2         55  
4             use base 'Rose::HTML::Form::Field::DateTime';
5 2     2   8  
  2         4  
  2         204  
6             our $VERSION = '0.606';
7              
8             1;
9              
10              
11             =head1 NAME
12              
13             Rose::HTML::Form::Field::DateTime::StartDate - Text field for a "start date" in a date range.
14              
15             =head1 SYNOPSIS
16              
17             $field =
18             Rose::HTML::Form::Field::DateTime::StartDate->new(
19             label => 'Date',
20             name => 'date',
21             default => '12/31/2002');
22              
23             print $field->internal_value; # "2002-12-31T00:00:00"
24             print $field->output_value; # "2002-12-31 00:00:00 PM"
25              
26             $field->input_value('blah');
27              
28             # "Could not parse date: blah"
29             $field->validate or warn $field->error;
30              
31             $field->input_value('4/30/1980 5:30 p.m.');
32              
33             $dt = $field->internal_value; # DateTime object
34              
35             print $dt->hour; # 17
36             print $dt->day_name; # Wednesday
37              
38             print $field->html;
39             ...
40              
41             =head1 DESCRIPTION
42              
43             L<Rose::HTML::Form::Field::DateTime::StartDate> is a subclass of L<Rose::HTML::Form::Field::DateTime> that pins the time to the very first moment of the specified date (i.e., 00:00:00.00000000) if the time is left unspecified.
44              
45             =head1 AUTHOR
46              
47             John C. Siracusa (siracusa@gmail.com)
48              
49             =head1 LICENSE
50              
51             Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.