diff options
author | dakkar <dakkar@luxion> | 2006-02-15 13:04:25 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2006-02-15 13:04:25 +0000 |
commit | d34d77b26311cf6b57e1e4c8edf4f90e29bdfcfb (patch) | |
tree | ba0d5ab29d149e75d1693f2ce0eb389997cd446a /GroLUG/lib/HTML/Widget/Constraint/ISODate.pm | |
parent | * migliorata formattazione delle date (diff) | |
download | IscrittiGroLUG-d34d77b26311cf6b57e1e4c8edf4f90e29bdfcfb.tar.gz IscrittiGroLUG-d34d77b26311cf6b57e1e4c8edf4f90e29bdfcfb.tar.bz2 IscrittiGroLUG-d34d77b26311cf6b57e1e4c8edf4f90e29bdfcfb.zip |
* ritocchi ai CSS
* corretta la validazione delle date
git-svn-id: svn://luxion/repos/IscrittiGroLUG/trunk@195 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'GroLUG/lib/HTML/Widget/Constraint/ISODate.pm')
-rw-r--r-- | GroLUG/lib/HTML/Widget/Constraint/ISODate.pm | 11 |
1 files changed, 9 insertions, 2 deletions
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; |