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*CWD             = 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), you could do it in one of the following ways:
97
98              1*12:0:24:0:0:0*FW1  = Christmas
99              1*12:0:25:0:0:0*FW1  = Boxing
100
101              1*12:0:24:0:0:0*FW1   = Christmas
102              1*12:0:25:0:0:0*FW1,a = Boxing
103
104              1*12:0:24:0:0:0*FW1  = Christmas
105              1*12:0:24:0:0:0*FW1  = Boxing
106
107           The following examples will NOT work:
108
109              1*12:0:24:0:0:0*FW1  = Christmas
110              1*12:0:24:0:0:0*FW2  = Boxing
111
112           The reasoning behind all this is as follows:
113
114           Holidays go into affect the minute they are parsed.  So, in the
115           case of:
116
117              1*12:0:24:0:0:0*FW1  = Christmas
118              1*12:0:24:0:0:0*FW2  = Boxing
119
120           the minute the first line is parsed, Christmas is defined as a
121           holiday.  The second line then steps forward 2 work days (skipping
122           Christmas since that's no longer a work day) and define the work
123           day two week days after Christmas, NOT the day after Christmas.
124
125           NOTE that since the definitions are stored in a list, NOT a hash
126           (as they were in Date::Manip 5.xx), you can use the definition:
127
128              1*12:0:24:0:0:0*FW1  = Christmas
129              1*12:0:24:0:0:0*FW1  = Boxing
130
131           to defined the days.
132

EVENTS

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

KNOWN BUGS

197       None known.
198

BUGS AND QUESTIONS

200       Please refer to the Date::Manip::Problems documentation for information
201       on submitting bug reports or questions to the author.
202

SEE ALSO

204       Date::Manip        - main module documentation
205

LICENSE

207       This script is free software; you can redistribute it and/or modify it
208       under the same terms as Perl itself.
209

AUTHOR

211       Sullivan Beck (sbeck@cpan.org)
212
213
214
215perl v5.12.0                      2010-04-27          Date::Manip::Holidays(3)
Impressum