Zend Framework

addMonth returns unexpected results

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.6.0
  • Component/s: Zend_Date
  • Labels:
    None

Description

date_default_timezone_set('America/Los_Angeles');
$now = new Zend_Date('2008-05-10 20:09:25', Zend_Date::ISO_8601);
echo $now . "\n";
$broke = clone $now;
$broke->addMonth(1);
echo $broke;

Result
May 10, 2008 8:09:25 PM
Jun 1, 2008 8:09:25 PM

Expected Result
May 10, 2008 8:09:25 PM
Jun 10, 2008 8:09:25 PM

Adding Zend_Date::setOptions(array('extend_month' => true)); fixes this problem for me. But, I would prefer to use the SQL method for adding months and not the spreadsheet style.

php -v
PHP 5.2.5 (cli) (built: Feb 20 2008 12:30:47)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Activity

Hide
Thomas Weidner added a comment -

Not reproducable with the actual trunk version.
Possibly already fixed in trunk with the actual r9459.

Show
Thomas Weidner added a comment - Not reproducable with the actual trunk version. Possibly already fixed in trunk with the actual r9459.
Hide
Wil Sinclair added a comment -

Updating for the 1.6.0 release.

Show
Wil Sinclair added a comment - Updating for the 1.6.0 release.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: