1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors calendar calendar.holidays
4 calendar.holidays.private calendar.private combinators
5 combinators.short-circuit kernel math sequences ;
6 IN: calendar.holidays.us
8 SINGLETONS: us us-federal ;
12 : adjust-federal-holiday ( timestamp -- timestamp )
14 { [ dup saturday? ] [ -1 days (time+) ] }
15 { [ dup sunday? ] [ 1 days (time+) ] }
21 M: us-federal holidays
23 [ clone ] dip execute( timestamp -- timestamp ) adjust-federal-holiday
26 : us-post-office-open? ( timestamp -- ? )
27 { [ sunday? not ] [ us-federal holiday? not ] } 1&& ;
29 HOLIDAY: new-years-day january 1 >>day ;
30 HOLIDAY-NAME: new-years-day world "New Year's Day"
31 HOLIDAY-NAME: new-years-day us-federal "New Year's Day"
33 HOLIDAY: martin-luther-king-day january 2 monday-of-month ;
34 HOLIDAY-NAME: martin-luther-king-day us-federal "Martin Luther King Day"
36 HOLIDAY: inauguration-day january 20 >>day [ dup 4 neg rem + ] change-year ;
37 HOLIDAY-NAME: inauguration-day us "Inauguration Day"
39 HOLIDAY: washingtons-birthday february 2 monday-of-month ;
40 HOLIDAY-NAME: washingtons-birthday us-federal "Washington's Birthday"
42 HOLIDAY: memorial-day may last-monday-of-month ;
43 HOLIDAY-NAME: memorial-day us-federal "Memorial Day"
45 HOLIDAY: independence-day july 4 >>day ;
46 HOLIDAY-NAME: independence-day us-federal "Independence Day"
48 HOLIDAY: labor-day september 0 monday-of-month ;
49 HOLIDAY-NAME: labor-day us-federal "Labor Day"
51 HOLIDAY: columbus-day october 1 monday-of-month ;
52 HOLIDAY-NAME: columbus-day us-federal "Columbus Day"
54 HOLIDAY-NAME: armistice-day us-federal "Veterans Day"
56 HOLIDAY: thanksgiving-day november 3 thursday-of-month ;
57 HOLIDAY-NAME: thanksgiving-day us-federal "Thanksgiving Day"
59 HOLIDAY: christmas-day december 25 >>day ;
60 HOLIDAY-NAME: christmas-day world "Christmas Day"
61 HOLIDAY-NAME: christmas-day us-federal "Christmas Day"
63 HOLIDAY: belly-laugh-day january 24 >>day ;
65 HOLIDAY: groundhog-day february 2 >>day ;
67 HOLIDAY: lincolns-birthday february 12 >>day ;
69 HOLIDAY: valentines-day february 14 >>day ;
71 HOLIDAY: st-patricks-day march 17 >>day ;
73 HOLIDAY: ash-wednesday easter 46 days time- ;
75 ALIAS: first-day-of-lent ash-wednesday
77 HOLIDAY: fat-tuesday ash-wednesday 1 days time- ;
79 HOLIDAY: good-friday easter 2 days time- ;
81 HOLIDAY: tax-day april 15 >>day ;
83 HOLIDAY: earth-day april 22 >>day ;
85 HOLIDAY: administrative-professionals-day april last-saturday-of-month wednesday ;
87 HOLIDAY: cinco-de-mayo may 5 >>day ;
89 HOLIDAY: mothers-day may 1 sunday-of-month ;
91 HOLIDAY: armed-forces-day may 2 saturday-of-month ;
93 HOLIDAY: national-donut-day june 0 friday-of-month ;
95 HOLIDAY: flag-day june 14 >>day ;
97 HOLIDAY: parents-day july 3 sunday-of-month ;
99 HOLIDAY: grandparents-day labor-day 1 weeks time+ ;
101 HOLIDAY: patriot-day september 11 >>day ;
103 HOLIDAY: stepfamily-day september 16 >>day ;
105 HOLIDAY: citizenship-day september 17 >>day ;
107 HOLIDAY: bosss-day october 16 >>day ;
109 HOLIDAY: sweetest-day october 2 saturday-of-month ;
111 HOLIDAY: halloween october 31 >>day ;
113 HOLIDAY: election-day november 0 monday-of-month 1 days time+ ;
115 HOLIDAY: black-friday thanksgiving-day 1 days time+ ;
117 HOLIDAY: pearl-harbor-remembrance-day december 7 >>day ;
119 HOLIDAY: new-years-eve december 31 >>day ;