Re: Date-class

From: Date: Wed, 18 Jul 2001 12:02:42 +0000
Subject: Re: Date-class
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-863@lists.php.net to get a copy of this message
At 13:42 2001-07-18 +0200, you wrote:
Sorry, I meant Date_Calc, not Date_Date. Yes, day of week and number of week is already in Date_Calc, and I was kinda hesitant about including them. They are however very useful. Should I keep them? Perhaps, it is possible to inherit your class from Date_Calc? So we can avoid to have different implementations of the same functionalty.
I have thought about that. Problem is that Date_Calc only consists of static functions, so in order to get some benefit from a subclassing we have to write wrapper-methods such as function &endOfNextMonth()
        return Date::FromISO(parent::endOfNextMonth($this->getDay(), $this->getMonth(), $this->getYear()));
} But that wasn't really the reason for the class. The main reason was to provide a common way of handling dates. So it would perhaps be better to keep the interface to a minimum and add more functionality through subclassing. Thus you can make a wrapper-class that maps to Date_Calc. /erik hjortsberg

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