Jifty:...teTime(3pm)

πŸ“¦
version 0.78 Β· 2 versions
  • 0.78 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.78 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Jifty::DBI::Filter::DateTime β€” it's giving DateTime object wrapper around date columns, bestie πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so listen. this filter lets you vibe with DateTime objects instead of boring plain-text dates. no cap. πŸŽ€

if the column type is date, then the hour, minute, and second info gets discarded when encoding. bye bye time-of-day details, we don't know her πŸ’…

and both input AND output will always be coerced into UTC (or, in the case of Dates, the Floating timezone) for consistency. fr fr, consistency is the moment.

🌸 formatter

this is an instance of the DateTime::Format object used for inflating the string in the database into a DateTime object. by default it's a DateTime::Format::Strptime object that uses the _strptime method as its pattern. iconic behavior honestly ✨

you can use the _formatter classdata storage as a cache so you don't need to re-instantiate your format object every decode. efficiency? we love to see it 🫢

πŸ’œ encode

if value is a DateTime object then it converts it into ISO format YYYY-MM-DD hh:mm:ss. does nothing if value is not defined. periodt.

sets the value to undef if the value is a string and doesn't match an ISO date (at least). like, at minimum. minimum effort bestie 😭

πŸŽ€ decode

if value is defined then it converts it into a DateTime object, otherwise it does nothing. that's it that's the whole vibe 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

  • Jifty::DBI::Filter
  • DateTime

and that's the tea, bestie πŸ“ this page rode in on perl v5.34.0, dated 2022-06-15, and it's part of the User Contributed Perl Documentation β€” go off, perl, we stan πŸ’–βœ¨

πŸ“¦ where this page comes from