1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
package HTML::Widget::Constraint::ISODate; use warnings;use strict;use base 'HTML::Widget::Constraint';use DateTime::Format::Strptime; my $format=DateTime::Format::Strptime->new(pattern=>'%F'); sub validate { my ($self,$value)=@_; my $val=$format->parse_datetime($value); return defined($val);} 1;