summaryrefslogtreecommitdiff
path: root/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm
diff options
context:
space:
mode:
Diffstat (limited to 'GroLUG/lib/HTML/Widget/Constraint/ISODate.pm')
-rw-r--r--GroLUG/lib/HTML/Widget/Constraint/ISODate.pm11
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;