Hy,

For example, just try this :

<?php
require_once 'Zend/Date.php';

class Fxc_Date_Public extends Zend_Date {
public function getNextWorkingDate()
{
   //$candidate = clone $this; // instead of $this -> getDate() which must
return a partial clone, according to the comments
    $candidate = $this->getDate(); // Tried this line also but works the
same way, no difference
   $candidate -> addDay(1);

   return $candidate;
}
}

$today = new Fxc_Date_Public();
print "<br>".$today->get(Zend_Date::ISO_8601);
print "<br>".$today->get(Zend_Date::YEAR);
easter_date($today->get(Zend_Date::YEAR)); //do nothing interesting but pass
$nextDay = $today -> getNextWorkingDate();
print "<br>".$nextDay->get(Zend_Date::ISO_8601);
print "<br>".$nextDay->get(Zend_Date::YEAR);
easter_date($nextDay->get(Zend_Date::YEAR)); // do nothing interesting but
fails and outputs a warning

Even in your exemple, you can see that the get() method called on the $today var returns 2007, whereas the same method called on the $nextDay var returns
7
Whatever, this exemple will show you explicitly the problem by outputting a
warning, because of the retrieve year, which is so 7 and not 2007.

When I run your example I get the following output but no warning or exception:
2007-03-30T14:13:51+02:00
2007
2007-03-31T04:00:00+02:00
2007

As your expected date is corrupted your problem must be related within your extended class. Maybe someone else within this forum can test your code and send the results ?

Greetings
Thomas
I18N Team Leader

Reply via email to