1Workflow::Validator::MaUtscehresCDoantterFiobrumtaetdW(o3Pr)ekrflloDwo:c:uVmaelnitdaattioorn::MatchesDateFormat(3)
2
3
4
6 Workflow::Validator::MatchesDateFormat - Ensure a stringified date
7 matches a given pattern
8
10 This documentation describes version 1.06 of this package
11
13 <action name="CreateNews">
14 <validator name="DateFormat">
15 <param name="date_format" value="%Y-%m-%d"/>
16 <arg value="$news_post_date"/>
17 </validator>
18 </action>
19
21 This documentation describes version 1.04 of
22 Workflow::Validator::MatchesDateFormat
23
25 This validator ensures that a given date string matches a "strptime"
26 pattern. The parameter 'date_format' is used to declare the pattern
27 against which the date string must be matched, and the single argument
28 is the date to match.
29
30 The 'date_format' pattern is a typical "strptime" pattern. See
31 DateTime::Format::Strptime for details.
32
33 NOTE: If you pass an empty string (or no string) to this validator it
34 will not throw an error. Why? If you want a value to be defined it is
35 more appropriate to use the 'is_required' attribute of the input field
36 to ensure it has a value.
37
38 Also, if you pass a DateTime object to the validator it will not
39 determine whether the date is correct or within a range. As far as it
40 is concerned its job is done.
41
42 METHODS
43 _init
44
45 This method initializes the class and the enumerated class.
46
47 It uses "add_enumerated_values" to add the set of values for
48 enumeration.
49
50 The primary parameter is value, which should be used to specify the
51 either a single value or a reference to array of values to be added.
52
53 validate
54
55 The validator method is the public API. It works with Workflow.
56
57 Based on the initialized Workflow::Validator it validates a provided
58 parameter, which should adhere to a predefined date format.
59
61 · You must define a value for 'date_format' in declaration of
62 validator <name>
63
64 · The value for 'date_format' must be a simple scalar in declaration
65 of validator <name>
66
67 · Date '<date_string>' does not match required pattern <pattern>
68
70 Workflow
71 Workflow::Validator
72 Workflow::Exception
73 DateTime
74
76 Copyright (c) 2003-2007 Chris Winters. All rights reserved.
77
78 This library is free software; you can redistribute it and/or modify it
79 under the same terms as Perl itself.
80
82 Current maintainer Jonas B. Nielsen <jonasbn@cpan.org>
83
84 Original author Chris Winters <chris@cwinters.com>
85
86
87
88perl v5.32.0 2020W-o0r7k-f2l8ow::Validator::MatchesDateFormat(3)