Zend Framework

addMonth dont change year in some cases

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Not an Issue
  • Affects Version/s: 1.10.0, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6
  • Fix Version/s: 1.10.7
  • Component/s: Zend_Date
  • Labels:
    None

Description

on 1 jul 2010 i run this code:

Zend_Loader::loadClass('Zend_Date');
$d = Zend_Date::now();
$d->addMonth(6);
die($d->toString('Y-MM-dd'));

and see
2010-01-01

Year must be 2011

Activity

Hide
David Stockton added a comment -

I am not able to reproduce this issue. I am on ZF 1.10.4 from SVN on PHP 5.2.12.

Results are as expected. Please find the attached patch file which adds a unit test which creates a Zend_Date object for July 1, 2010 and adds 6 months and then asserts the result is January 1, 2011.

Please let me know if I should be providing patches in a different way or if this sort of contribution is helpful or not.

Thank you,
David Stockton

Show
David Stockton added a comment - I am not able to reproduce this issue. I am on ZF 1.10.4 from SVN on PHP 5.2.12. Results are as expected. Please find the attached patch file which adds a unit test which creates a Zend_Date object for July 1, 2010 and adds 6 months and then asserts the result is January 1, 2011. Please let me know if I should be providing patches in a different way or if this sort of contribution is helpful or not. Thank you, David Stockton
Hide
Thomas Weidner added a comment -

You should note that according to the manual, the examples, the class, the code and the unittests the constant "Y" is the ISO year.

The ISO year or Calendar year is the year which is printed on a calendar.
The ISO year begins with the week where the thursday is the 1st or higher.

The calendar year is not the real year... look at your calendar and you will see this.

@David:
It makes no sense to integrate a patch for things which are definitely non-issues or wrong code/assumptions from a user. When you take a look at Zend_Date's testbed you will see that it's the biggest testbed from the framework.

Show
Thomas Weidner added a comment - You should note that according to the manual, the examples, the class, the code and the unittests the constant "Y" is the ISO year. The ISO year or Calendar year is the year which is printed on a calendar. The ISO year begins with the week where the thursday is the 1st or higher. The calendar year is not the real year... look at your calendar and you will see this. @David: It makes no sense to integrate a patch for things which are definitely non-issues or wrong code/assumptions from a user. When you take a look at Zend_Date's testbed you will see that it's the biggest testbed from the framework.
Hide
Thomas Weidner added a comment -

Closing as non-issue

Show
Thomas Weidner added a comment - Closing as non-issue
Hide
Thomas Weidner added a comment -

Correct fix version as it has been deleted unintentionally by another user

Show
Thomas Weidner added a comment - Correct fix version as it has been deleted unintentionally by another user

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: