1Date::Manip::Holidays(3U)ser Contributed Perl DocumentatiDoante::Manip::Holidays(3)
2
3
4

NAME

6       Date::Manip::Holidays - describes holidays and events
7

SYNOPSIS

9       This describes the Holidays and Events sections of the config file, and
10       how they are used.
11
12       Holidays and events are specific days that are named. Holidays are used
13       in business mode calculations, events are not. Events may be used for
14       other calendaring operations.
15

HOLIDAYS

17       The holiday section of the config file is used to define holidays.
18       Each line is of the form:
19
20          STRING = HOLIDAY
21
22       HOLIDAY is the name of the holiday (or it can be blank in which case
23       the day will still be treated as a holiday... for example the day after
24       Thanksgiving is often a work holiday though it is not named).
25
26       STRING is a string which can be parsed to give a valid date. It can be
27       any of the following forms:
28
29       A full date
30           Specific holidays can be set which occur only a single time.
31
32              May 5, 2000                     = A one-time-only holiday
33
34           Any format parseable by Date::Manip::Date::parse_date can be used.
35
36       A date without a year
37           Some holidays occur every year on the same day. These can be
38           defined using the simple lines:
39
40              Jan 1                           = New Year's Day
41              Jul 4th                         = Independence Day
42              fourth Thu in Nov               = Thanksgiving
43
44           These dates must be written in a form which can be parsed as a full
45           date by simply adding the year to the end of the string. Please
46           refer to the Date::Manip::Date documentation to see what forms will
47           work. ISO 8601 dates will not work since the year comes first.
48
49           Any format parseable by Date::Manip::Date::parse_date can be used.
50
51       Recurrence
52           The dates can be specified using recurrences:
53
54              1*0:0:0:0:0:0*EASTER            = Easter
55              1*11:0:11:0:0:0*DWD             = Veteran's Day
56
57           In cases where you are interested in business type calculations,
58           you'll want to define most holidays using recurrences, since they
59           can define when a holiday is celebrated in the financial world.
60           For example, Christmas might be defined as:
61
62              Dec 25               = Christmas
63
64           but if it falls on a weekend, there won't be a business holiday
65           associated with it. It could be defined using a recurrence:
66
67              1*12:0:24:0:0:0*DWD  = Christmas
68
69           so that if Christmas falls on a weekend, a holiday will be taken on
70           the Friday before or the Monday after the weekend.
71
72           You can use the fully specified format of a recurrence:
73
74             1*2:0:1:0:0:0***Jan 1 1999*Dec 31 2002 = Feb 2 from 1999-2002
75

OTHER HOLIDAY CONSIDERATIONS

77       Recurrences which change years
78           It is now valid to have a recurrence defined for New Year's day
79           which pushes the holiday to the previous year.
80
81           For example, the most useful definition of New Year's day is:
82
83              1*1:0:1:0:0:0*DWD               = New Year's Day
84
85           which means to choose the closest working day to observe the
86           holiday, even though this might mean that the holiday is observed
87           on the previous year.
88
89       Order of definitions is preserved
90           The order of the definitions is preserved. In other words, when
91           looking at the holidays for a year, previously defined holidays (in
92           the order given in the config file) are correctly handled.
93
94           As an example, if you wanted to define both Christmas and Boxing
95           days (Boxing is the day after Christmas, and is celebrated in some
96           parts of the world), and you wanted to celebrate Christmas on a
97           business day on or after Dec 25, and Boxing day as the following
98           work day, you could do it in one of the following ways:
99
100              1*12:0:25:0:0:0*NWD  = Christmas
101              1*12:0:26:0:0:0*NWD  = Boxing
102
103           or
104
105              1*12:0:25:0:0:0*NWD  = Christmas
106              1*12:0:25:0:0:0*NWD  = Boxing
107
108           Holidays go into affect the minute they are parsed which is why the
109           second example works (though for clarity, the first one is
110           preferable).  The first recurrence defined the first business day
111           on or after Dec 25 as Christmas.  The second one then defines the
112           business day after that as Boxing day.  Since the definitions are
113           stored as a list (NOT a hash as they were in Date::Manip 5.xx),
114           using the same recurrence twice does not cause a problem.
115

EVENTS

117       The Events section of the config file is similar to the Holiday
118       section.  It is used to name certain days or times, but there are a few
119       important differences:
120
121       Events can be assigned to any time and duration
122           All holidays are exactly 1 day long.  They are assigned to a period
123           of time from midnight to midnight.
124
125           Events can be based at any time of the day, and may be of any
126           duration.
127
128       Events don't affect business mode calculations
129           Unlike holidays, events are completely ignored when doing business
130           mode calculations.
131
132       Whereas holidays were added with business mode math in mind, events
133       were added with calendar and scheduling applications in mind.
134
135       Every line in the events section is of the form:
136
137          EVENT = NAME
138
139       where NAME is the name of the event, and EVENT defines when it occurs
140       and its duration.  An EVENT can be defined in the following ways:
141
142          Date
143          YMD
144          YM
145          Recur
146
147          Date  ; Date
148          YMD   ; YMD
149          YM    ; YM
150          Date  ; Delta
151          Recur ; Delta
152
153       Date refers to a full date/time (and is any string that can be parsed
154       by Date::Manip::Date::parse). YMD is any string which can be parsed by
155       Date::Manip::Date::parse_date. YM is any string which can be parsed by
156       the parse_date method to give a date in the current year. Recur is a
157       partial or fully specified recurrence. Delta is any string that can be
158       parsed to form a delta.
159
160       With the "Date" form, or the "Recur" form, the event starts at the time
161       (or times) specified by the date or recurrence, and last 1 hour long.
162       With the "YMD" and "YM" forms, the event occurs on the given day, and
163       lasts all day.
164
165       With all of the two part forms ("Date;Date", "YM;YM", etc.), the event
166       starts at the first date and goes to the second date, or goes an amount
167       of time specified by the delta.
168
169       The "YMD;YMD" and "YM;YM" forms means that the event lasts from the
170       start of the first date to the end of the second. In the Date;Date
171       form, the event goes from the first date to the second date inclusive.
172       In other words, both dates are in the event. In the "Date;Delta" and
173       "Recur;Delta" forms, the Delta tells the length of the event. Also, in
174       the Date;Date form, the second date may NOT be expressed as a delta.
175
176       Currently, having an event longer than 1 year is NOT supported, but no
177       checking is done for this.
178

KNOWN BUGS

180       None known.
181

BUGS AND QUESTIONS

183       Please refer to the Date::Manip::Problems documentation for information
184       on submitting bug reports or questions to the author.
185

SEE ALSO

187       Date::Manip        - main module documentation
188

LICENSE

190       This script is free software; you can redistribute it and/or modify it
191       under the same terms as Perl itself.
192

AUTHOR

194       Sullivan Beck (sbeck@cpan.org)
195
196
197
198perl v5.10.1                      2011-12-07          Date::Manip::Holidays(3)
Impressum