ZF-11939: Problem with Zend_Date Component

Description

Grettings, I used to develop with CodeIgniter i'm studying Zend. I joined a team of programmers that is already using Zend, and my first job is correct a bug. The project uses Flex/AMF with Zend/php . I'm parsing a string date from flex to zend as following:

public function setRgExpedicao($value) { if ($value instanceof Zend_Date) { $value = $value->toString ( 'Y-m-d' ); } else if (null !== $value && false === is_string ( $value )) { throw new App_Exception ( 'Unsupported type or format of dataInicial' ); } $this->_set ( 'rgExpedicao', $value ); }

The Bug is, in some years like 1953 the date generated always has a day less, for exemple: Flex passes 1953-2-2 Zend_Date generates 1953-2-1. The bug is very curiuos, some years it generates the correct date like 2011-02-02. Can someone help me?

Comments

Per default Zend_Date utilize the format iso (but allow that be change to format php see the option format_type). This is your problem 'Y-m-d' change to yyyy-MM-dd.

Greetings Ramon