Re: Call for Votes: PEAR::Calendar
| From: | Alan Knowles | Date: | Thu, 23 Oct 2003 01:58:57 +0000 |
| Subject: | Re: Call for Votes: PEAR::Calendar | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22922@lists.php.net to get a copy of this message | ||
Harry, you know what I will say on this :)
20 classes to do a calender is a little of an overkill (reminds me of the joke in an eddy murphy movie about using AK47 to shoot game)
I like the idea of having a class to contain the date/time, but a single slightly larger class that handles all time/date combinations would make sense..
eg.
$date = Calendar_DateTime::make(2000,10,1);
$datetime = Calendar_DateTime::make(2000,10,1,10,15,1);
(using func_get_args() to determine how may args....)
there seems alot of repetition in all the Day/Month/Year classes... that would be eliminated by this..
alot the nextDay/nextYear may be handled better by something like
$nextday = $date->make($date->year, $date->month, $date+1);
$nextmonth = $date->make($date->year, $date->month+1, $date);
that way
a) you dont have to document alot of very simple, & obvious methods
b) the user doesnt have to remember all the methods..
(basically it's pretty much how mktime works....)
Other points (partly from the FAQ)
- using define rather than require_once
Thats one of the PEAR coding standards.. - you probably dont gain very much doing it that way.. - from what I remember they both do the same thing internally (look up a hash table)..
It would be nice to handle non-unixtime dates like < 1970.. - but I guess that has to wait until we have someone bothered to write the algoritmns to do it...
Regards
Alan
Harry Fuecks wrote:
Proposed Name: Calendar Proposed Category: Calendar (new namespace) PEAR::Calendar is an package for generating Calendars as data structures (it does not render content) allowing you to easily connect up a user interface with an underlying data store (such as MySQL). It provides a simple API to make generating a calendar much like querying a database - just pick a date then render the output with a loop. It's also extensible so should (in theory) be a foundation for generating practically any calendar you can think of (the challenge is a Chinese calendar). PEAR package: ------------- http://prdownloads.sourceforge.net/htmlsax/Calendar-0.1.tgz?download Extensive README: ----------------- http://htmlsax.sourceforge.net/calendar/ API documentation: ------------------ http://htmlsax.sourceforge.net/calendar/api/ Examples: --------- http://htmlsax.sourceforge.net/calendar/examples/ This follows the earlier package proposal: http://marc.theaimsgroup.com/?l=pear-dev&m=106045306402489&w=2 to which the issues raised have been addressed (it's now extensible and no longer tied to Unix timestamps). Also package name change on recommendation, from Date_Calendar to Calendar One thing that would be very good would be volunteers willing to help maintain the package. Timewise there's never enough. [PS: Please note I can only post on the mailing list in the evenings...] Thanks, Harry-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com