Data::FormValidator::Constraints::Dates - Validate Dates and Times |
Data::FormValidator::Constraints::Dates - Validate Dates and Times
# In a Data::FormValidator Profile: validator_packages => [qw(Data::FormValidator::Constraints::Dates)], constraints => { date_and_time_field => { constraint_method => 'date_and_time', params=>[\'MM/DD/YYYY hh:mm:ss pp'], # 'pp' denotes AM|PM for 12 hour representation }, }
Note: This is a new module is a new addition to Data::FormValidator and is should be considered ``Beta''.
This constraint creates a regular expression based on the format string passed in to validate your date against. It understands the following symbols:
Y year (numeric) M month (numeric) D day (numeric) h hour m minute s second p AM|PM
Other parts of the string become part of the regular expression, so you can do perlish things like this to create mor complex expressions:
'MM?/DD?/YYYY|YYYY-MM?-DD?'
Internally the Date::Calc manpage is used to test the functions.
the Data::FormValidator manpage, the DateTime::Format::Pg manpage, the DateTime::Format::MySQL manpage, the DateTime::Format::Mail manpage
Mark Stosberg, <mark@summersault.com>
Copyright 2003 by Mark Stosberg
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Data::FormValidator::Constraints::Dates - Validate Dates and Times |