Valida...::Date(3pm)
π Validation::Class::Directive::Date β date directive for Validation Class field definitions π
okay bestie so this is Validation::Class::Directive::Date from the User Contributed Perl Documentation corner of the universe, and it's literally the directive that does date validation for your field definitions. it's giving "core validation class field directive" energy, periodt.
β¨ VERSION β¨
version 7.900059 β yes that's a lot of digits, she's specific like that π
πΈ SYNOPSIS πΈ
here's the whole vibe, no cap:
use Validation::Class::Simple;
my $rules = Validation::Class::Simple->new(
fields => {
creation_date => {
date => 1
}
}
);
# set parameters to be validated
$rules->params->add($parameters);
# validate
unless ($rules->validate) {
# handle the failures
}
like, you set up your rules, you add your params, you validate, and if it fails you handle the failures. iconic workflow fr fr π¦
π DESCRIPTION π
Validation::Class::Directive::Date is a core validation class field directive that provides validation of simple date formats. that's the whole job bestie, and she does it flawlessly π«Ά
so here's the tea β the directive can take these options:
- alternative argument: an-array-of-options π
- option:
dmyβ e.g.27-12-2006or27-12-06 - option:
mdyβ e.g.12-27-2006or12-27-06 - option:
ymdβ e.g.2006-12-27or06-12-27 - option:
dMyβ e.g.27 December 2006or27 Dec 2006 - option:
Mdyβ e.g.December 27, 2006orDec 27, 2006(comma optional) - option:
Myβ e.g.December 2006orDec 2006 - option:
myβ e.g.12/2006
bestie pay attention: that Mdy one? the comma is optional. so don't come for her about punctuation. π
and the way she's flexible?? this directive can be passed a single value or an array of values. look:
fields => {
creation_date => {
date => ['dmy', 'mdy']
}
}
multiple formats in one directive?? she ate that. no notes. π₯
π AUTHOR π
Al Newkirk <anewkirk@ana.io> β the genius behind the whole thing, we stan π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2011 by Al Newkirk.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. free as in freedom bestie, go wild π§
okay and that's a wrap!! this page was brought to you by perl v5.36.0 and it was documented on 2023-06-11, and you read all of it, which means you're lowkey a date-validation expert now. main character energy honestly. mwah πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- debian trixie: libvalidation-class-perl 7.900059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libvalidation-class-perl 7.900059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libvalidation-class-perl 7.900059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libvalidation-class-perl 7.900059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms