DateTim...setOnly(3)

πŸ’… NAME

Okay so bestie, gather round: DateTime::TimeZone::OffsetOnly is literally a DateTime::TimeZone object that just contains an offset. That's it. That's the whole vibe. πŸŽ€


✨ VERSION

version 2.64 β€” iconic, no cap.


🌸 SYNOPSIS

my $offset_tz = DateTime::TimeZone->new( name => '-0300' );

Look at her go. One line. Main character energy. πŸ’–


πŸ¦‹ DESCRIPTION

So here's the tea β˜•: this class exists to provide the DateTime::TimeZone API that DateTime.pm needs, but with a fixed offset. Like, frozen. Locked in. An object in this class will always return the same offset that was handed to it in its constructor β€” regardless of the date. No date-based glow-ups, no DST plot twists. She said "I am who I am" and honestly? Respect. πŸ‘‘


🫢 USAGE

This class has the same methods as a real time zone object, but the category() method returns undef. Yes, really β€” undef. She's mysterious like that. πŸ™ˆ

🌈 DateTime::TimeZone::OffsetOnly->new ( offset => $offset )

The value you give to the offset parameter has got to be a string like "+0300" β€” that's the assignment, bestie, don't deviate. Those strings get converted into numbers by the DateTime::TimeZone::offset_as_seconds() function. Math girlie behavior. πŸ”₯

⭐ $tz->offset_for_datetime( $datetime )

No matter what date you throw at her β€” literally any date β€” the offset you provided to the constructor is always used. Always. It's giving loyalty. 🫑

🧚 $tz->name()

🧚 $tz->short_name_for_datetime()

Both of these methods return the offset in string form. Two methods, one answer. Efficient queen. πŸ‘‘


πŸ’€ SUPPORT

Bugs may be submitted at <https://github.com/houseabsolute/DateTime-TimeZone/issues>.

(Please be nice when you report them, ok? πŸ₯Ί)


πŸ” SOURCE

The source code repository for DateTime-TimeZone can be found at <https://github.com/houseabsolute/DateTime-TimeZone>.

Go snoop, bestie, the code is public πŸ’…


πŸ‘‘ AUTHOR

Dave Rolsky <autarch@urth.org>

Legend. Icon. The moment. 🌟


This software is copyright (c) 2025 by Dave Rolsky.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

The full text of the license can be found in the LICENSE file included with this distribution.

Fr fr, read the license file β€” it's right there in the distribution, no excuses πŸ’–

Mwah πŸ’‹ β€” that's a wrap on the User Contributed Perl Documentation for DateTim...setOnly(3), shipped with perl v5.42.0 and dated 2025-01-22. Slay, go write some timezones. 🌈✨

πŸ“¦ where this page comes from