Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sunrise and sunset wrong on March 20th and 21st #31

Open
craigstanton opened this issue Mar 19, 2022 · 1 comment
Open

Sunrise and sunset wrong on March 20th and 21st #31

craigstanton opened this issue Mar 19, 2022 · 1 comment

Comments

@craigstanton
Copy link

Describe the bug
The sunrise and set times for Auckland, NZ on March 20th and 21st are incorrect. Sunrise is reported as 11:12PM and 4:58AM, then on March 22nd it is back to accurate with 7:26AM

To Reproduce
Using the Sun example from the repo

use Andrmoel\AstronomyBundle\AstronomicalObjects\Sun;
use Andrmoel\AstronomyBundle\Location;
use Andrmoel\AstronomyBundle\TimeOfInterest;

date_default_timezone_set('NZDT');
for ($day = 15; $day < 25; $day++) {

// Auckland
$location = Location::create(-36.86297, 174.71185);
$datetime = new DateTime("2022-03-".$day."T00:00:00.000+00:00", new DateTimeZone("UTC"));


$date = (clone($datetime))->setTime(...[23,59,59])->setTimezone(new DateTimeZone('UTC'));
$toi = TimeOfInterest::createFromDateTime($date);

// Create sun
$sun = Sun::create($toi);

// Rise, set and upper culmination
$rise = $sun->getSunrise($location);
$culmination = $sun->getUpperCulmination($location);
$set = $sun->getSunset($location);


echo <<<END
+------------------------------------
|    Date: {$sun->getTimeOfInterest()} UTC  ---> Sunrise: {$rise->getDateTime()->format('Y-m-d H:i:s')} UTC ---> Sunset: {$set->getDateTime()->format('Y-m-d H:i:s')} UTC
+------------------------------------

END;
}

Expected behavior
Sunrise should be a smooth transition from March 19th (7:23am) to 22nd (7:26am)

Desktop (please complete the following information):

  • OS: Alpine 3.13
  • Version 2.0.1

Additional context
There's PHP reported for doing something similar that may be of interest
https://bugs.php.net/bug.php?id=53148

@craigstanton
Copy link
Author

craigstanton commented Mar 19, 2022

I've check this with coordinates (0,0) too and it has the same problem. This is part of the output

+------------------------------------
| Date: 2022-03-18 23:59:59 UTC ---> Sunrise: 2022-03-18 06:04:47 UTC ---> Sunset: 2022-03-18 18:11:18 UTC
+------------------------------------

+------------------------------------
|    Date: 2022-03-19 23:59:59 UTC  ---> Sunrise: 2022-03-19 06:04:29 UTC ---> Sunset: 2022-03-19 18:11:00 UTC
+------------------------------------

+------------------------------------
|    Date: 2022-03-20 23:59:59 UTC  ---> Sunrise: 2022-03-19 23:09:23 UTC ---> Sunset: 2022-03-20 09:42:00 UTC
+------------------------------------

+------------------------------------
|    Date: 2022-03-21 23:59:59 UTC  ---> Sunrise: 2022-03-21 03:20:54 UTC ---> Sunset: 2022-03-21 15:31:22 UTC
+------------------------------------

+------------------------------------
|    Date: 2022-03-22 23:59:59 UTC  ---> Sunrise: 2022-03-22 06:03:36 UTC ---> Sunset: 2022-03-22 18:10:07 UTC
+------------------------------------

+------------------------------------
|    Date: 2022-03-23 23:59:59 UTC  ---> Sunrise: 2022-03-23 06:03:18 UTC ---> Sunset: 2022-03-23 18:09:49 UTC
+------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant