From: Jeremy McAnally Date: 2007-01-03T11:38:27+09:00 Subject: Re: Detecting holidays Okay, I got the code done. I just need to create lists of holidays now. I can do the U.S. holidays (if I need any help algorithm-wise, I'll let you guys know...), but I have no clue about UK or anyone else's holidays. Anyone from another locality care to englighten me? I called it "special_days" because Im hoping it can be used for purposes other than just holidays (birthdays? patch_days? The possibilities are approaching limitless!). I'm working on getting a gem together right now... --Jeremy On 1/2/07, Daniel Berger wrote: > Hi all, > > Well, it took seven years, but I've finally been annoyed enough by > reports failing on national holidays to say something. Report writers > know the routine: > > Them: Why did the report fail for Jan. 1st? > Me: National holiday. There was no data to grab. Ignore the failure. > Them: Oh, right. > > Repeat again for Memorial Day, July 4th, Thanksgiving, and Christmas. > > Is there a package out there that deals with national holidays (for any > nation)? The only thing I came across what date2, but that only seems > to handle Japanese national holidays. I guess I'm looking for > something like Perl's Date::Calc [1] module or, more specifically, it's > Date::Calendar::Profiles [2] module. Or something like Perl's > Date::Holidays::XXX [3] approach (I'm not sure which is preferred these > days). > > Ideally, I'd like to be able to do something like: > > if Date.today.is_national_holiday? > exit # Don't run report on this day > end > > And no, it's not a simple matter of using something more flexible than > cron because some reports pull data from X days back or ahead, not on > the date they're run. > > Thoughts? > > - Dan > > [1] http://search.cpan.org/~stbey/Date-Calc-5.4/Calendar.pod > [2] > http://search.cpan.org/~stbey/Date-Calc-5.4/lib/Date/Calendar/Profiles.pod > [3] > http://search.cpan.org/~jonasbn/Date-Holidays-0.08/lib/Date/Holidays.pm > > > -- My free Ruby e-book: http://www.humblelittlerubybook.com/book/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.com/