1MooseX::Types::DateTimeU(s3e)r Contributed Perl DocumentaMtoioosneX::Types::DateTime(3)
2
3
4
6 MooseX::Types::DateTime - DateTime related constraints and coercions
7 for Moose
8
10 version 0.13
11
13 Export Example:
14
15 use MooseX::Types::DateTime qw(TimeZone);
16
17 has time_zone => (
18 isa => TimeZone,
19 is => "rw",
20 coerce => 1,
21 );
22
23 Class->new( time_zone => "Africa/Timbuktu" );
24
26 This module packages several Moose::Util::TypeConstraints with
27 coercions, designed to work with the DateTime suite of objects.
28
29 Namespaced Example:
30
31 use MooseX::Types::DateTime;
32
33 has time_zone => (
34 isa => 'DateTime::TimeZone',
35 is => "rw",
36 coerce => 1,
37 );
38
39 Class->new( time_zone => "Africa/Timbuktu" );
40
42 DateTime
43 A class type for DateTime.
44
45 from "Num"
46 Uses "from_epoch" in DateTime. Floating values will be used for
47 sub-second precision, see DateTime for details.
48
49 from "HashRef"
50 Calls "new" in DateTime with the hash entries as arguments.
51
52 Duration
53 A class type for DateTime::Duration
54
55 from "Num"
56 Uses "new" in DateTime::Duration and passes the number as the
57 "seconds" argument.
58
59 Note that due to leap seconds, DST changes etc this may not do
60 what you expect. For instance passing in 86400 is not always
61 equivalent to one day, although there are that many seconds in
62 a day. See "How Date Math is Done" in DateTime for more
63 details.
64
65 from "HashRef"
66 Calls "new" in DateTime::Duration with the hash entries as
67 arguments.
68
69 DateTime::Locale
70 A class type for DateTime::Locale::root with the name
71 DateTime::Locale.
72
73 from "Str"
74 The string is treated as a language tag (e.g. "en" or "he_IL")
75 and given to "load" in DateTime::Locale.
76
77 from Locale::Maktext
78 The "Locale::Maketext/language_tag" attribute will be used with
79 "load" in DateTime::Locale.
80
81 DateTime::TimeZone
82 A class type for DateTime::TimeZone.
83
84 from "Str"
85 Treated as a time zone name or offset. See "USAGE" in
86 DateTime::TimeZone for more details on the allowed values.
87
88 Delegates to "new" in DateTime::TimeZone with the string as
89 the "name" argument.
90
92 MooseX::Types::DateTime::MoreCoercions
93
94 DateTime, DateTimeX::Easy
95
97 Bugs may be submitted through the RT bug tracker
98 <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types-
99 DateTime> (or bug-MooseX-Types-DateTime@rt.cpan.org <mailto:bug-MooseX-
100 Types-DateTime@rt.cpan.org>).
101
102 There is also a mailing list available for users of this distribution,
103 at <http://lists.perl.org/list/moose.html>.
104
105 There is also an irc channel available for users of this distribution,
106 at irc://irc.perl.org/#moose.
107
109 יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
110
112 • Karen Etheridge <ether@cpan.org>
113
114 • Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
115
116 • Florian Ragwitz <rafl@debian.org>
117
118 • John Napiorkowski <jjnapiork@cpan.org>
119
120 • Shawn M Moore <sartak@gmail.com>
121
122 • Dave Rolsky <autarch@urth.org>
123
125 This software is copyright (c) 2008 by יובל קוג'מן (Yuval Kogman).
126
127 This is free software; you can redistribute it and/or modify it under
128 the same terms as the Perl 5 programming language system itself.
129
130
131
132perl v5.32.1 2021-01-27 MooseX::Types::DateTime(3)