From d34d77b26311cf6b57e1e4c8edf4f90e29bdfcfb Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 15 Feb 2006 13:04:25 +0000 Subject: * ritocchi ai CSS * corretta la validazione delle date git-svn-id: svn://luxion/repos/IscrittiGroLUG/trunk@195 fcb26f47-9200-0410-b104-b98ab5b095f3 --- GroLUG/lib/HTML/Widget/Constraint/ISODate.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'GroLUG/lib/HTML/Widget/Constraint/ISODate.pm') diff --git a/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm b/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm index f5680d2..9712d3b 100644 --- a/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm +++ b/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm @@ -10,9 +10,16 @@ my $format=DateTime::Format::Strptime->new(pattern=>'%F'); sub validate { my ($self,$value)=@_; - my $val=$format->parse_datetime($value); + my $ret=eval { + my $val=$format->parse_datetime($value); + return unless defined($val); - return defined($val); + my $round_tripped=$val->strftime('%F'); + + return ($value eq $round_tripped); + }; + return if $@; + return $ret; } 1; -- cgit v1.2.3