ZF-4820: Zend_date 12 december 2009 to januari 2010 problem

Description

I have a strange problem with Zend_Date when adding 1 month to December 2009. Zend_Date goes back to January 2009 instead of increasing the year to 2010.

I used this code to test it: ( tested with versions 1.6.1, 1.6.2 and trunk)

<?php $oDate = new Zend_Date( array( 'year' => 2008, 'month' => 12, 'day' => 01 ) ); echo $oDate->toString( 'dd-MM-YYYY' ) . "
"; $oDate->addMonth( 1 ); echo $oDate->toString( 'dd-MM-YYYY' ) . "
"; $oDate = new Zend_Date( array( 'year' => 2009, 'month' => 05, 'day' => 01 ) ); echo $oDate->toString( 'dd-MM-YYYY' ) . "
"; $oDate->addMonth( 1 ); echo $oDate->toString( 'dd-MM-YYYY' ) . "
"; $oDate = new Zend_Date( array( 'year' => 2009, 'month' => 12, 'day' => 01 ) ); echo $oDate->toString( 'dd-MM-YYYY' ) . "
"; $oDate->addMonth( 1 ); echo $oDate->toString( 'dd-MM-YYYY' ) . "
"; ?>

Results: 01-12-2008 01-01-2009 <== as expected 01-05-2009 01-06-2009 <== as expected 01-12-2009 01-01-2009 <== expected 01-01-2010 here

Comments

The "problem" is described in the manual.

By replacing all YYYY with yyyy it gives me this (as expected): 01-12-2008 01-01-2009 01-05-2009 01-06-2009 01-12-2009 01-01-2010

..closing as not an issue for now.

@Dolf,

Hmzzz stupid me, why didn't I think of that.... Thnx!