Workflo...eFormat(3)

πŸ“¦
version 2.09 Β· 2 versions
, in fedora 44

πŸ’– 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 🌈

  • Workflow
  • Workflow::Validator
  • Workflow::Exception
  • DateTime

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