HTML::...teTime(3pm)
π HTML::FormFu::Inflator::CompoundDateTime β the manual page, bestie edition π
okay so you're reading HTML::FormFu::Inflator::CompoundDateTime(3pm) from the User Contributed Perl Documentation, and honestly? it's giving "glow-up for your form fields." β¨
πΈ NAME πΈ
HTML::FormFu::Inflator::CompoundDateTime β the CompoundDateTime inflator. that's it, that's the name, she's iconic π
β VERSION β
version 2.07 π
π¦ SYNOPSIS π¦
so here's the whole vibe, literally:
---
element:
- type: Multi
name: date
elements:
- name: day
- name: month
- name: year
inflator:
- type: CompoundDateTime
# get the submitted value as a DateTime object
my $date = $form->param_value('date');
like, you set up your Multi element, you drop the inflator in, and boom β $date is a whole DateTime object now. main character behaviour fr fr ππ
π DESCRIPTION π
bestie listen. this one is for use with a HTML::FormFu::Element::Multi group of fields. π
it changes the input from several fields into a single DateTime value. multiple little fields walk in, one DateTime walks out. ate. π₯
by default, she expects the field names to be any of these:
year
month
day
hour
minute
second
nanosecond
time_zone
that's the whole default squad. if your names match, you're done, no cap β¨
π METHODS π
π field_order
Arguments: \@order
okay so if your field names don't follow the convention listed above, you must provide an arrayref containing the above names, in the order they correspond with your own fields. like, you're translating your field names into her language π«Ά
---
element:
- type: Multi
name: date
elements:
- name: m
- name: d
- name: y
inflator:
- type: CompoundDateTime
field_order:
- month
- day
- year
see how m, d, y get matched up to month, day, year? that's the whole trick π
π§ strptime
Arguments: \%args
Arguments: $string
this one's optional. she defines the format that should be used if the DateTime object is stringified. so like, when your DateTime gets turned into a string, this is the lewk it serves π
she accepts a hashref of arguments to be passed to "new" in DateTime::Format::Strptime. or, alternatively, she accepts a single string argument, suitable for passing to "DateTime::Format::Strptime->new( pattern => $string )". either way works, pick your fighter β¨
---
inflator:
- type: CompoundDateTime
strptime:
pattern: '%d-%b-%Y'
locale: de
---
inflator:
- type: CompoundDateTime
strptime: '%d-%m-%Y'
first one is the hashref route with a lil locale: de moment π©πͺ, second one is the single-string shortcut. both slay π
π AUTHOR π
Carl Franks
πΈ LICENSE πΈ
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
π AUTHOR π
Carl Franks <cpan@fireartist.com>
β¨ COPYRIGHT AND LICENSE β¨
This software is copyright (c) 2018 by Carl Franks.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
ok that's the whole page, you made it to the end, so proud of you π₯Ήπ go forth and compound those date times, bestie.
and a lil sign-off from the universe: this was perl v5.28.1, dated 2019-01-12, and yes she's still serving π πβ
π¦ where this page comes from
- debian bookworm: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-formfu-perl 2.07000-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