HTML::...teTime(3pm)

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

✨ NAME ✨

HTML::FormFu::Constraint::DateTime β€” the DateTime constraint, bestie πŸ’–

It's literally a constraint that makes sure your input can later be inflated into a DateTime object. Periodt.


🌸 VERSION 🌸

version 2.07 β€” yes she's got a version, she's official πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

okay so here's the whole vibe, look at this:

---
elements:
  - type: Text
    name: start_date
    constraints:
      - type: DateTime
        parser:
          strptime: '%d-%m-%Y'

  - type: Text
    name: end_time
    constraints:
      - type: DateTime
        parser:
          regex: !!perl/regexp '^(\d{2}) - (\d{2}) - (\d{4})$'
          params: [day, month, year]

and here's the slay-est trick ever: using the same parser declaration for both a DateTime constraint and a DateTime inflator, with YAML references 🧚✨

---
elements:
  - type: Text
    name: date
    constraints:
      - type: DateTime
        parser: &PARSER
          strptime: '%d-%m-%Y'
    inflators:
      - type: DateTime
        parser: *PARSER
not the &PARSER and *PARSER doing a little anchor-and-alias duet 🫢 iconic behaviour, honestly

πŸ’œ DESCRIPTION πŸ’œ

Her whole job? Make sure the input can later be inflated to a DateTime object. That's it. That's the gig. No cap. πŸ‘‘


πŸ”₯ METHODS πŸ”₯

🌈 parser

Arguments: \%args

Required. Like, you have to give her this, she will not guess πŸ™ˆ

Define the expected input string, so that DateTime::Format::Builder knows how to turn it into a DateTime object. πŸ¦‹

It accepts arguments to be passed to "parser" in DateTime::Format::Builder. So whatever that one takes, she takes. iykyk πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

Carl Franks, cfranks@cpan.org


πŸ“ 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>

(yes bestie, he's listed twice β€” we love a double feature πŸ’–)


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 β€” brought to you by perl v5.28.1 on 2019-01-12, and filed away under HTML::FormFu::Constraint::DateTime(3pm). mwah πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from