summaryrefslogtreecommitdiff
path: root/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2006-02-13 15:53:39 +0000
committerdakkar <dakkar@luxion>2006-02-13 15:53:39 +0000
commitc58b498f7060665e286b1b7eb978cebeed9e8655 (patch)
tree24a6e00ca314ca57c157c9684c2e582607ed1251 /GroLUG/lib/HTML/Widget/Constraint/ISODate.pm
parent r1314@narval: dakkar | 2006-02-10 19:50:50 +0100 (diff)
downloadIscrittiGroLUG-c58b498f7060665e286b1b7eb978cebeed9e8655.tar.gz
IscrittiGroLUG-c58b498f7060665e286b1b7eb978cebeed9e8655.tar.bz2
IscrittiGroLUG-c58b498f7060665e286b1b7eb978cebeed9e8655.zip
merge dalla branch
git-svn-id: svn://luxion/repos/IscrittiGroLUG/trunk@191 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'GroLUG/lib/HTML/Widget/Constraint/ISODate.pm')
-rw-r--r--GroLUG/lib/HTML/Widget/Constraint/ISODate.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm b/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm
new file mode 100644
index 0000000..f5680d2
--- /dev/null
+++ b/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm
@@ -0,0 +1,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;