Zend Framework

Zend_Date::getSunrise() and Zend_Date::getSunset()

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.0RC3, 1.5.1
  • Fix Version/s: 1.6.0
  • Component/s: Zend_Date
  • Labels:
    None

Description

Functions

Zend_Date::getSunrise()
and
Zend_Date::getSunset()
return "1970-12-08T00:00:00-03:00" for any date/time and city.

The problem occoured in revision 2729:

Where it says

'Zend_Date::TIMESTAMP'
, it should say
Zend_Date::TIMESTAMP
(without the quotes, otherwise
Zend_Date::set()
does not recognize the constant).

Activity

Hide
Thomas Weidner added a comment -

Interesting...

I am doing this:

$date = new Zend_Date(1010101010);
        $date->setTimezone('Indian/Maldives');

        $result = $date->getSunset(Zend_Date_Cities::City('vienna'));
        echo $result->get(Zend_Date::W3C);

and it returns this:

'2002-01-04T20:09:59+05:00'

So in my eyes it works.

I think you made a mistake by using getSunset as static which is not true. This should throw an error by php as this method is not static and needs an instance.

If not, please give a reproducable example, so we can verify the problem.

Show
Thomas Weidner added a comment - Interesting... I am doing this:
$date = new Zend_Date(1010101010);
        $date->setTimezone('Indian/Maldives');

        $result = $date->getSunset(Zend_Date_Cities::City('vienna'));
        echo $result->get(Zend_Date::W3C);
and it returns this:
'2002-01-04T20:09:59+05:00'
So in my eyes it works. I think you made a mistake by using getSunset as static which is not true. This should throw an error by php as this method is not static and needs an instance. If not, please give a reproducable example, so we can verify the problem.
Hide
Paulo Roberto Maurici Junior added a comment -

Actually I didn't use the static method.

But now I tested it in a separate file, outside my MVC, and it worked.

The problem only happens when i use the following code before the calculation:

Zend_Date::setOptions(array('format_type' => 'php'));

Shouldn't it still be ok to do date calculations even though i set 'format_type' to 'php' ?

By the way, thanks for the quick response.

Show
Paulo Roberto Maurici Junior added a comment - Actually I didn't use the static method. But now I tested it in a separate file, outside my MVC, and it worked. The problem only happens when i use the following code before the calculation:
Zend_Date::setOptions(array('format_type' => 'php'));
Shouldn't it still be ok to do date calculations even though i set 'format_type' to 'php' ? By the way, thanks for the quick response.
Hide
Thomas Weidner added a comment -

Fixed with r9258

Show
Thomas Weidner added a comment - Fixed with r9258
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 (1)

Dates

  • Created:
    Updated:
    Resolved: