MooseX:...ntained(3)
π¦ MooseX::Types::DateTime::ButMaintained π¦
okay bestie, so this is the User Contributed Perl Documentation page (section 3, iykyk) for MooseX::Types::DateTime::ButMaintained β the module that gives you DateTime-related constraints and coercions for Moose. it's giving β¨time mathβ¨ and it's lowkey a whole saga (see DESCRIPTION, there's lore, there's drama, there's a fork). grab a boba and let's go π
β¨ NAME β¨
MooseX::Types::DateTime::ButMaintained β DateTime related constraints and coercions for Moose. that's the whole thing, that's the thesis π
πΈ SYNOPSIS πΈ
π«Ά Export Example
you just pull in what you need by name and vibe check it:
use MooseX::Types::DateTime::ButMaintained qw(TimeZone);
has time_zone => (
isa => TimeZone
, is => "rw"
, coerce => 1
);
Class->new( time_zone => "Africa/Timbuktu" );
Class->new( time_zone => "CEST" );
π«Ά Namespaced Example
or you go full namespace main-character mode and just use the module:
use MooseX::Types::DateTime::ButMaintained;
has time_zone => (
isa => 'DateTime::TimeZone'
, is => "rw"
, coerce => 1
);
Class->new( time_zone => "Africa/Timbuktu" );
π CONSTRAINTS π
these are the type constraints, and every single one of them comes with coercions, no cap π₯
π DateTime
a class type for DateTime.
- from
Numβ usesfrom_epochin DateTime. Floating values will be used for subsecond percision, see DateTime for details. π - from
HashRefβ callsnewin DateTime with the hash entries as arguments.
π Duration
a class type for DateTime::Duration.
- from
Numβ usesnewin DateTime::Duration and passes the number as thesecondsargument.
bestie, WARNING: due to leap seconds, DST changes etc this may not do what you expect. For instance passing in 86400 is not always equivalent to one day, although there are that many seconds in a day. See "How Date Math is Done" in DateTime for more details. π time is fake and the calendar is lying to you.
- from
HashRefβ callsnewin DateTime::Duration with the hash entries as arguments.
π DateTime::Locale
a class type for DateTime::Locale::root with the name DateTime::Locale.
- from
Strβ the string is treated as a language tag (e.g."en"or"he_IL") and given toloadin DateTime::Locale. π - from
Locale::Maktextβ theLocale::Maketext/language_tagattribute will be used withloadin DateTime::Locale.
π DateTime::TimeZone
a class type for DateTime::TimeZone. this now as of 0.05 coerces from non-globally ambigious Olson abbreviations, using Olson::Abbreviations. this won't work for abbreviations like "EST" which are only unambigious if you know the locale. it will coerce from abbreviations like "CEST" though. slay π
- from
Strβ treated as a time zone name or offset. See "USAGE" in DateTime::TimeZone for more details on the allowed values.
delegates to new in DateTime::TimeZone with the string as the name argument.
π§ SEE ALSO π§
go read these too, they're iconic:
MooseX::Types::DateTimeXDateTime
π AUTHOR π
Modern
Evan Carroll <me+cpan@evancarroll.com>
Yesteryear
Yuval Kogman <nothingmuch@woobling.org>
John Napiorkowski <jjn1056 at yahoo.com>
π DESCRIPTION π
okay so this module packages several Moose::Util::TypeConstraints with coercions, designed to work with the DateTime suite of objects. cute, useful, obsessed π«Ά
now for the lore, because this module has history and the original doc says it out loud: this module started as a fork of MooseX::Types::DateTime. the history and explaination goes like this β In Janurary 2009, I began a project to bring DateTime::Format::* stuff up to date with Moose. I created a framework that would greatly eliminate redundant code named DateTimeX::Format. this project's adoption was slowed by then (and still currently) bundeled package MooseX::Types::DateTime. MooseX::Types::DateTime was a badly packaged extention of two modules: the self-titled MooseX::Types::DateTime, and another random module MooseX::Types::DateTimeX. In Februrary of the same year, I repackaged the module MooseX::Types::DateTimeX with the authors blessing into a new package, for the purpose of removing its dependenices β namely Date::Manip β from MooseX::Types::DateTime.
unfortunately, this just added confusion. now, as of the time of writing, MooseX::Types::DateTimeX is available as a package, and it is available as a module which will be installed by MooseX::Types::DateTime. the benefit of removing the dependency on MooseX::Types::DateTime was never realized, and the patch that updates the dependencies, and the build system, remains in rt still as of writing. π not the rt ticket still open.
so what IS this module, fr fr? this module is just the MooseX::Types::DateTime without the requirement on DateTimeX::Easy (which requires DateTime::Manip). and as of 0.05 this module supports globally unique Olson abbreviations, and dies when they are not globally unique. it does not play, it does not negotiate π
π COPYRIGHT π
Copyright (c) 2008 Yuval Kogman. All rights reserved
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
Modifications (c) 2009 Evan Carroll. All rights reserved
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
and that's the page bestie!! π this doc was rendered by perl v5.42.0 on 2025-07-25, and that's the whole vibe check β go forth and coerce your timestamps responsibly. periodt πβ¨
π¦ where this page comes from
- fedora 43: perl-MooseX-Types-DateTime-ButMaintained 0.16-38.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms