|
NAMERose::HTML::Form::Field::DateTime - Text field that inflates valid dates and times into DateTime objects. SYNOPSIS $field =
Rose::HTML::Form::Field::DateTime->new(
label => 'Date',
name => 'date',
default => '12/31/2002 8pm');
print $field->internal_value; # "2002-12-31T20:00:00"
print $field->output_value; # "2002-12-31 08:00:00 PM"
$field->input_value('blah');
# "Could not parse date: blah"
$field->validate or warn $field->error;
$field->input_value('4/30/1980 5:30 p.m.');
$dt = $field->internal_value; # DateTime object
print $dt->hour; # 17
print $dt->day_name; # Wednesday
print $field->html;
...
DESCRIPTIONRose::HTML::Form::Field::DateTime is a subclass of Rose::HTML::Form::Field::Text that allows only valid dates as input, which it then coerces to DateTime objects. It overrides the validate(), inflate_value(), and deflate_value() methods of its parent class. Valid input is converted to the format "YYYY-MM-DD HH:MM:SS AM/PM" on output. OBJECT METHODS
SEE ALSOOther examples of custom fields:
AUTHORJohn C. Siracusa (siracusa@gmail.com) LICENSECopyright (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.
|