HTML::...teTime(3pm)

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

πŸ’– HTML::FormFu::Deflator::CompoundDateTime πŸ’–

okay bestie, so this page lives in the User Contributed Perl Documentation section of your man pages, and it's literally all about one little deflator. periodt. let's get into it 🫢


✨ NAME ✨

HTML::FormFu::Deflator::CompoundDateTime β€” the CompoundDateTime deflator, no cap πŸ’…


🌸 VERSION 🌸

version 2.07 β€” that's the one, that's the vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

here's how you set it up, fr fr:

---
element:
  - type: Multi
    name: date

    elements:
      - name: day
      - name: month
      - name: year

    deflator:
      - type: CompoundDateTime

and then to set the default, you do this:

# set the default

$form->get_field('date')->default( $datetime );

slay. that's the whole flow. ✨


πŸ’œ DESCRIPTION πŸ’œ

so this deflator is made for when you're working with a HTML::FormFu::Element::Multi group of fields β€” you know, a lil squad of inputs that are all lowkey about the same thing. πŸ‘‘

what it does: it takes one single DateTime value and sets the default values of several fields from it. one source of truth, many fields. main character energy honestly.

by default, it expects the field names to be any of the following:

  • year
  • month
  • day
  • hour
  • minute
  • second
  • nanosecond
  • time_zone

that's the standard lineup. if your fields are named like that, you're already winning. πŸ’…


🌈 METHODS 🌈

πŸ“ field_order πŸ“

Arguments: \@order

okay so if your field names don't follow the convention listed above, that's totally fine, you just gotta help a girl out β€” you must provide an arrayref containing the above names, in the order they correspond with your own fields. 🧚

like this:

---
element:
  - type: Multi
    name: date

    elements:
      - name: m
      - name: d
      - name: y

    deflator:
      - type: CompoundDateTime
        field_order:
          - month
          - day
          - year

see how m, d, y map to month, day, year? iconic. the order you list them in is the order that matters, iykyk. πŸŽ€


πŸ‘‘ 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.


and that's the whole page bestie!! no notes, ate and left no crumbs πŸ’–

this was perl v5.28.1, dated 2019-01-12, and it's still out here being HTML::FormFu::Deflator::CompoundDateTime coded. stay slaying, go format some datetimes πŸŒΈπŸ’…βœ¨

πŸ“¦ where this page comes from