Data::...::Dates(3pm)
π NAME π
okay bestie, say hi to Data::FormValidator::Constraints::Dates β she validates Dates and Times β¨ (the manual page up top calls her Data::...::Dates, but that's just her nickname in the perl docs, iykyk π)
πΈ SYNOPSIS πΈ
use Data::FormValidator::Constraints::Dates qw(date_and_time);
# In a DFV profile...
constraint_methods => {
# 'pp' denotes AM|PM for 12 hour representation
my_time_field => date_and_time('MM/DD/YYYY hh:mm:ss pp'),
}
π¦ DESCRIPTION π¦
β¨ date_and_time β¨
Note: this is a new module, a brand new addition to Data::FormValidator, and she should be considered "Beta". πΌ treat her gentle.
This constraint literally builds a regular expression out of the format string you hand it, and then uses that regex to check your date. So you say the format, she does the vibe check π
Here are the symbols she understands, periodt:
Y year (numeric)
M month (numeric)
D day (numeric)
h hour
m minute
s second
p AM|PM
Every other bit of the string just becomes part of the regular expression, no cap. Which means you can do perlish things like this to cook up way more complex expressions:
'MM?/DD?/YYYY|YYYY-MM?-DD?'
Under the hood, Date::Calc is used to test the functions. π§
π BACKWARDS COMPATIBILITY π
This older, more awkward interface is still supported (she's got history, we respect her π):
# In a Data::FormValidator Profile:
validator_packages => [qw(Data::FormValidator::Constraints::Dates)],
constraints => {
date_and_time_field => {
constraint_method => 'date_and_time',
params=>[\'MM/DD/YYYY hh:mm:ss pp'], # 'pp' denotes AM|PM for 12 hour representation
},
}
π SEE ALSO π
Data::FormValidatorπData::FormValidator::Constraints::DateTimeβ this alternative features returning dates as DateTime objects and validating against the date formats required for the MySQL and PostgreSQL databases. iconic.
π«Ά AUTHOR π«Ά
Mark Stosberg, <mark@summersault.com>
Featuring clever code by Jan Krynicky. (shoutout, king π)
π COPYRIGHT AND LICENSE π
Copyright 2003-2005 by Mark Stosberg
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie π this was rendered by perl v5.34.0 and dated 2022-06-12, so likeβ¦ consider this your little timestamped love letter from the Data::...::Dates(3pm) docs. slay, go validate something β¨π
π¦ where this page comes from
- debian bookworm: libdata-formvalidator-perl 4.88-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdata-formvalidator-perl 4.88-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdata-formvalidator-perl 4.88-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdata-formvalidator-perl 4.88-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdata-formvalidator-perl 4.88-2 Β· 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