This is a definite bug with Zend_Date that no one wants to admit.

Use the config option 'extended_month' = true to use Excel style date
addition/subtraction.

On Mon, Jun 30, 2008 at 6:02 AM, fab2008 <[EMAIL PROTECTED]> wrote:

>
> You're right, here is the iso output (with the same code as above), but the
> result is the same :-(
>
> When I add months the date remains unchanged (except for the first add),
> and
> when I subtracting subMonth() subtract two months every step, I'm pretty
> confused
>
> string(25) "2008-06-30T08:57:04-04:00"
>
> string(13) "adding months"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> ...
> string(18) "subtracting months"
> string(25) "2008-05-01T08:57:04-04:00"
> string(25) "2008-03-01T08:57:04-05:00"
> string(25) "2008-01-01T08:57:04-05:00"
> string(25) "2007-11-01T08:57:04-04:00"
> string(25) "2007-09-01T08:57:04-04:00"
> string(25) "2007-07-01T08:57:04-04:00"
> string(25) "2007-05-01T08:57:04-04:00"
> string(25) "2007-03-01T08:57:04-05:00"
> string(25) "2007-01-01T08:57:04-05:00"
> string(25) "2006-11-01T08:57:04-05:00"
> string(25) "2006-09-01T08:57:04-04:00"
> ...
>
>
> thomasW wrote:
> >
> > Please give the full iso representation as output. (getIso())
> > All other outputs are useless as they miss needed informations which are
> > not
> > provided in your text.
> >
> > Greetings
> > Thomas Weidner, I18N Team Leader, Zend Framework
> > http://www.thomasweidner.com
> >
> > ----- Original Message -----
> > From: "fab2008" <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Monday, June 30, 2008 3:08 AM
> > Subject: [fw-general] Zend_Date problem with add/subMonth()
> >
> >
> >>
> >> I'm writing a caledar script for managing orders. I want to implement an
> >> iCal
> >> like interface for operators, so i created a calendar class; among its
> >> methods I have two methods, getPreviousLink and getNextLink() that point
> >> to
> >> previous and next month. When I create an object of this class, if no
> day
> >> parameter is passed, I create an empty Zend_Date representig current
> >> date.
> >> Howewer when I build links using Zend_Date::addMonth() and subMonth() I
> >> get
> >> a very strange (for me) behaviour, i created some test code to reproduce
> >> the
> >> problem:
> >>
> >> Zend_Debug::dump("adding months");
> >> $a = new Zend_Date();
> >> Zend_Debug::dump($a->toString());
> >> for ($i = 0; $i < 24; $i++) {
> >> $a->addMonth(1);
> >> Zend_Debug::dump($a->toString());
> >> }
> >> Zend_Debug::dump("subtracting months");
> >> $a = new Zend_Date();
> >> for ($i = 0; $i < 24; $i++) {
> >> $a->subMonth(1);
> >> Zend_Debug::dump($a->toString());
> >> }
> >>
> >> the result for this code is:
> >>
> >> string(20) "29/giu/2008 20:56:13"
> >>
> >> string(12) "adding months"
> >> string(20) "01/lug/2008 20:56:13"
> >> string(20) "01/lug/2008 20:56:13"
> >> string(20) "01/lug/2008 20:56:13"
> >> string(20) "01/lug/2008 20:56:13"
> >> string(20) "01/lug/2008 20:56:13"
> >> ...
> >> string(18) "subtracting months"
> >> string(20) "01/mag/2008 21:02:38"
> >> string(20) "01/mar/2008 21:02:38"
> >> string(20) "01/gen/2008 21:02:38"
> >> string(20) "01/nov/2007 21:02:38"
> >> string(20) "01/set/2007 21:02:38"
> >> string(20) "01/lug/2007 21:02:38"
> >> string(20) "01/mag/2007 21:02:38"
> >> string(20) "01/mar/2007 21:02:38"
> >> ...
> >>
> >> Is this a bug or i misunderstood Zend_Date::add/subMonth() function?
> >>
> >> Can anyone help me?
> >>
> >> P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18195152.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


-- 
Michael DePetrillo
[EMAIL PROTECTED]
Mobile: (858) 761-1605
AIM: klassicd

www.michaeldepetrillo.com

Reply via email to