Re: Date_Holidays

From: Date: Sat, 18 Oct 2003 19:48:39 +0000
Subject: Re: Date_Holidays
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22800@lists.php.net to get a copy of this message
Validate does something similary (SSN's in US are different than Germany for instance). Following it's model I would envision something like this: Date/Holidays.php Date/Holidays/EN.php Date/Holidays/CA.php Date/Holidays.php would have Date_Holidays.php with you factory, which would then create instances of Date/Holidays/EN.php and return valid holidays. --Joe > Hi, > > I will have to implement a calendar in PHP that knows when certain > holidays (like easter) are. > I thought about implementing the algorithm in a class called > Date_Holidays, so it can be used in PEAR. > But as different countries have different holidays (in the US, labour > day is in September, in Germany it's in May) I thought about a factory > method like: > > $holidays = Date_Holidays::getHolidays('Germany'); > > This will return an object Date_Holidays_German, so at a later point > Date_Holdays_France, etc. could be implemented. > > The object could then supply some methods to check whether a date is a > holiday, list all holidays in a certain year or return one holiday for > one year... > > Any thoughts or comments about this? I'll probably start working on this > next monday. > > Stephan > --- > Stephan Schmidt > schst@php-tools.net > http://www.php-tools.net > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Joe Stump <joe@joestump.net> http://www.joestump.net "Label makers are proof God wants Sys Admins to be happy."

« previous php.pear.dev (#22800) next »