zf1s / zf1

Monorepo of a fork of Zend Framework 1, with all components split into individual composer packages. PHP 5.3-8.3 compatible.
BSD 3-Clause "New" or "Revised" License
57 stars 22 forks source link

[zend-date] properly calculate sunrise, sunset and twilight times #151

Closed falkenhawk closed 1 year ago

falkenhawk commented 1 year ago

date_sunset() and date_sunrise() are deprecated in php 8.1+ - switched to recommended date_sun_info() function (which is available since php v5.1) https://www.php.net/manual/en/function.date-sun-info.php#refsect1-function.date-sun-info-returnvalues

but that function yields slightly different results since zenith angles for sunrise/sunset/twilights are hardcoded internally and they are different to what zf used before (see $horizonDeclination in Zend_Date::calcSun() - moved from Zend_Date::_checkLocation())

Yet ONLY NOW they are accurate! (calculations for civil / nautical / astronomical twilight were totally wrong before)