Chris Winters > Workflow-0.17 > Workflow::Validator::MatchesDateFormat

Download:
Workflow-0.17.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  6
Open  1
View/Report Bugs
Module Version: 1.05   Source   Latest Release: Workflow-1.40

NAME ^

Workflow::Validator::MatchesDateFormat - Ensure a stringified date matches a given pattern

SYNOPSIS ^

 <action name="CreateNews">
   <validator name="DateFormat">
      <param name="date_format" value="%Y-%m-%d"/>
      <arg value="$news_post_date"/>
   </validator>
 </action>

DESCRIPTION ^

This validator ensures that a given date string matches a strptime pattern. The parameter 'date_format' is used to declare the pattern against which the date string must be matched, and the single argument is the date to match.

The 'date_format' pattern is a typical strptime pattern. See DateTime::Format::Strptime for details.

NOTE: If you pass an empty string (or no string) to this validator it will not throw an error. Why? If you want a value to be defined it is more appropriate to use the 'is_required' attribute of the input field to ensure it has a value.

Also, if you pass a DateTime object to the validator it will not determine whether the date is correct or within a range. As far as it is concerned its job is done.

COPYRIGHT ^

Copyright (c) 2003-2004 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS ^

Chris Winters <chris@cwinters.com>

syntax highlighting: