HTML::...teTime(3pm)

πŸ“¦
version 2.07000 Β· 5 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

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


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