Workflo...eFormat(3)
π Workflow::Validator::MatchesDateFormat π
okay bestie, so this is a page from the User Contributed Perl Documentation and it's all about Workflow::Validator::MatchesDateFormat β the little validator that makes sure your date string actually looks like the date format you said it should. fr fr, it's giving gatekeeper but in a helpful way π
β¨ VERSION β¨
This documentation describes version 2.09 of this package. periodt. π
πΈ SYNOPSIS πΈ
action:
- name: CreateNews
validator:
- name: DateFormat
param:
- name: date_format
value: '%Y-%m-%d'
arg:
- '$news_post_date'
like... that's the whole vibe. a validator named DateFormat, a date_format param, and one arg that's the date you wanna check. π¦
π DESCRIPTION π
So what does this thing actually do? It makes sure a given date string matches a "strptime" pattern. The parameter 'date_format' is how you declare the pattern your date string has to match against, and the single argument is... the date itself. the one getting vibe checked. β¨
The 'date_format' pattern is a typical "strptime" pattern. Go peek at DateTime::Format::Strptime for the details, iykyk. π
NOTE: If you pass an empty string (or no string at all) to this validator, it will not throw an error. Why tho? Because if you want a value to actually be defined, the more appropriate move is using the 'is_required' attribute of the input field to make sure it has a value. this validator is not your mom, it's not gonna yell at you for an empty string. π
Also β and this is important β 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's concerned, its job is done. it clocked out, bestie. π
π§ METHODS π§
_init
This method initializes the class and the enumerated class.
It uses "add_enumerated_values" to add the set of values for enumeration.
The primary parameter is value, which should be used to specify the either a single value or a reference to array of values to be added. π
validate
The validator method is the public API. It works with Workflow.
Based on the initialized Workflow::Validator it validates a provided parameter, which should adhere to a predefined date format. slay. β
π₯ EXCEPTIONS π₯
- You must define a value for
'date_format'in declaration of validator <name> - The value for
'date_format'must be a simple scalar in declaration of validator <name> - Date '<date_string>' does not match required pattern <pattern>
these are the three ways it can be like "bestie no". don't take it personally. π«Ά
π SEE ALSO π
WorkflowWorkflow::ValidatorWorkflow::ExceptionDateTime
π COPYRIGHT π
Copyright (c) 2003-2021 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.
Please see the LICENSE
π« AUTHORS π«
Please see Workflow
and that's the whole page, babe π this doc was brought to you by perl v5.42.0, dated 2026-01-17 β yes we're serving vintage β¨ mwah, go validate some dates π π
π¦ where this page comes from
- fedora 44: perl-Workflow 2.09-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms