code
Algorithms for the calculation are available all over the 'net, but most of them involve a lot of magic numbers and don't explain very clearly what exactly is going on. I'm not a fan of copy-and-paste coding -- you can't debug it if you don't understand it -- and I needed to calculate Easter dates for a calendaring project I'm thinking about writing in Ruby. As far a I could tell, there weren't any Ruby libraries or modules that did this, so I wrote one up. (I didn't know about the date2 library at the time, but even so, having things wrapped up in a gem seems to be the way to go nowadays.)
(release pending)
A Perl module to calculate Canadian statutory holiday dates.
While working on a web-based time tracker at
UVic,
I came up against the problem of figuring out which days should
automagically come up as stat holidays. In my humble opinion, it's
not a particularly 'interesting' problem in the technical sense --
it's got a lot of annoying edge cases and lacks any particularly
fun technical challenges. Nobody should have to solve this problem
twice, and so I set about putting together a CPAN module.
As an aside, we Canadians have a really messed up system of stat holidays. There are federal holidays and provincial holidays, but they don't stack; some provinces don't recognize some of the federal ones, so essentially you have 14 totally separate juristictions when it comes to holiday lists. This says nothing of some of the inane municipal holidays. For instance, I am told that the day of the Calgary Stampede Parade is a half-day holiday within the city of Calgary only. Better yet, the day of the Royal St. John's Regatta is a stat holiday in St. John's -- but the Regatta is postponed if the weather conditions aren't suitable, and the holiday goes with it. (I am not sure how I am going to implement this one -- perhaps Acme::Test::Weather will come into play here.)
I throw the occasional patch into Parrot and ack. I'm also interested on hacking on Pugs and Jifty, but haven't quite got there yet.