HTML::...rftime(3pm)
π HTML::FormFu::Deflator::Strftime π
okay bestie so this is HTML::FormFu::Deflator::Strftime, a page straight outta the User Contributed Perl Documentation, and it's a Strftime deflator. that's the whole vibe. let's get into it π
β¨ VERSION β¨
version 2.07 β that's the one, no cap πΈ
π¦ SYNOPSIS π¦
here's the whole thing in action, literally copy-paste energy:
$form->deflator( Strftime => 'start_time' )
->strftime( '%d/%m/%Y' );
---
elements:
- type: Text
inflators:
- type: DateTime
parser:
strptime: "%Y/%m/%d"
deflator:
- type: Strftime
strftime: "%Y/%m/%d"
see how it goes both ways?? strptime going in, strftime coming back out. it's giving symmetry. π
π DESCRIPTION π
so basically: this is a Strftime deflator for DateTime objects. π°οΈ
here's the situation. when you redisplay a form to the user after an invalid submission, any fields with DateTime inflators will stringify to something like '1970-01-01T00:00:00'. likeβ¦ bestie. that is not the serve. π
in most cases it makes way more sense to use the same format you've asked the user for. that's the whole point of this deflator β it lets you specify a more suitable and user-friendly format. iconic behavior honestly β¨
ngl the mechanics are simple: this deflator calls DateTime's strftime method. the possible values for the format string are documented at:
<http://search.cpan.org/dist/DateTime/lib/DateTime.pm#strftime_Patterns>
(go read that if you wanna know your % codes, iykyk π)
and here's a lil bonus moment π β if you set the form's locale (see "locale" in HTML::FormFu), this gets set on the DateTime object. now you can use %x to get the default date, or %X for the default time, for the object's locale. localized date formatting?? we love to see it π¦
π AUTHOR π
Carl Franks, "cfranks@cpan.org" β the legend himself π«Ά
π LICENSE π
this library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. slay, free software π
πΈ AUTHOR πΈ
wait, again?? yes bestie, the manpage really does list it twice:
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. periodt. π
lowkey reminder: this whole thing rides onperl v5.28.1, dated2019-01-12, and it lives in the User Contributed Perl Documentation. mwah, thanks for coming to my ted talk ππβ¨
π¦ 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