1Workflow::Validator::MaUtscehresCDoantterFiobrumtaetdW(o3Pr)ekrflloDwo:c:uVmaelnitdaattioorn::MatchesDateFormat(3)
2
3
4

NAME

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

VERSION

10       This documentation describes version 1.61 of this package
11

SYNOPSIS

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

DESCRIPTION

21       This validator ensures that a given date string matches a "strptime"
22       pattern. The parameter 'date_format' is used to declare the pattern
23       against which the date string must be matched, and the single argument
24       is the date to match.
25
26       The 'date_format' pattern is a typical "strptime" pattern. See
27       DateTime::Format::Strptime for details.
28
29       NOTE: If you pass an empty string (or no string) to this validator it
30       will not throw an error. Why? If you want a value to be defined it is
31       more appropriate to use the 'is_required' attribute of the input field
32       to ensure it has a value.
33
34       Also, if you pass a DateTime object to the validator it will not
35       determine whether the date is correct or within a range. As far as it
36       is concerned its job is done.
37
38   METHODS
39       _init
40
41       This method initializes the class and the enumerated class.
42
43       It uses "add_enumerated_values" to add the set of values for
44       enumeration.
45
46       The primary parameter is value, which should be used to specify the
47       either a single value or a reference to array of values to be added.
48
49       validate
50
51       The validator method is the public API. It works with Workflow.
52
53       Based on the initialized Workflow::Validator it validates a provided
54       parameter, which should adhere to a predefined date format.
55

EXCEPTIONS

57       •   You must define a value for 'date_format' in declaration of
58           validator <name>
59
60       •   The value for 'date_format' must be a simple scalar in declaration
61           of validator <name>
62
63       •   Date '<date_string>' does not match required pattern <pattern>
64

SEE ALSO

66       Workflow
67       Workflow::Validator
68       Workflow::Exception
69       DateTime
70
72       Copyright (c) 2003-2022 Chris Winters. All rights reserved.
73
74       This library is free software; you can redistribute it and/or modify it
75       under the same terms as Perl itself.
76
77       Please see the LICENSE
78

AUTHORS

80       Please see Workflow
81
82
83
84perl v5.36.0                      2023W-o0r1k-f2l0ow::Validator::MatchesDateFormat(3)
Impressum