Prima::...et::Time(3)

πŸ“¦
version 1.74000 Β· 5 versions
, in opensuse-leap 16.0

πŸ’– Prima::Widget::Time β€” the time input widget that just gets it πŸ’–

okay so bestie, this is from the User Contributed Perl Documentation for Prima::...et::Time(3) (yes the header's a lil truncated in the wild, that's just how it's spelled, don't come for me 🫢), and it's genuinely one of the cutest lil widgets in the Prima family. It's the standard time input widget, and β€” plot twist β€” it's derived from the Prima::InputLine class. Iconic lineage, honestly.


✨ SYNOPSIS ✨

like, the whole vibe in four lines:

        use Prima qw(Application Widget::Time);

        my $mw = Prima::MainWindow->new;
        $mw->insert( 'Widget::Time' =>
                pack => { fill => 'x', pad => 20 },
        );

        run Prima;

no cap, that's it. you insert a 'Widget::Time', you pack it with fill => 'x' and pad => 20, you run Prima, and the clock is literally clocking. πŸ’…


🌸 DESCRIPTION 🌸

Standard time input widget πŸ’– β€” derived from the Prima::InputLine class. That's the whole thing, she's simple and she's serving.


πŸŽ€ API πŸŽ€

πŸ¦‹ Methods πŸ¦‹

  • time2str TIME β€” converts the TIME into a string representation, according to whatever the current format string is set to. it's giving "say it in human, pls". ✨
  • default_format β€” returns a string meant to be used in format, where that string is constructed to reflect the formatting of the regional time preferences. localized and thoughtful, we love to see it 🌈

See also: man 3 strftime, %X .

  • str2time STRING β€” tries to extract a time out of STRING, assuming it was constructed according to the current format string. and here's the thing πŸ‘€ β€” it doesn't fail, but any values that could not be extracted get assigned to the current second/minute/hour instead. so no crashing, just a lil "we'll keep what we had" energy 😭
  • validate_time S, M, H β€” checks whether S, M, H form a valid point in time, and adjusts the values if they don't. returns the corrected values. she's the responsible friend fr fr 🫢

πŸ’œ Properties πŸ’œ

  • format STRING β€” this is the format string, used when converting the time to its visual interpretation, also with regional preferences β€” f ex hh:mm:ss or hh:mm:AA . the syntax of the format is verbatim as this, i e it recognizes the fixed patterns hh, mm, ss, aa, and AA, replacing them with the time values.

("aa" is for <am / pm>, "AA" is for <AM / PM>). πŸ’… case matters, bestie!

  • hour β€” selects the hour.
  • minute β€” selects the minute.
  • second INTEGER β€” selects the second.
  • time SEC, MIN, HOUR | [ SEC, MIN, HOUR ] β€” accepts three integers, or an arrayref with three integers, in the format of localtime. SEC and MIN can be from 0 to 59, and HOUR from 0 to 23.

Default value: today's time. ⭐

lowkey the ranges are the whole personality check β€” you go out of 0..59 / 0..23 and that's a whole thing, so keep it cute and in range πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

Dmitry Karasik, <dmitry@karasik.eu.org>. thank you king, the widget ate πŸ”₯


🌟 SEE ALSO 🌟

Prima::InputLine β€” go look at the parent, she raised a good one πŸ’–


okay that's the whole page!! and as a lil sign-off: this beauty ships as perl v5.42.0, dated 2024-08-20 β€” that's the source/version + date footer, folded in all cute so you don't gotta squint at it πŸŽ€βœ¨ go forth and let your users pick a time, mwah πŸ’…

πŸ“¦ where this page comes from