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

Sunset before sunrise? #79

Open
craigstanton opened this issue Nov 14, 2024 · 1 comment
Open

Sunset before sunrise? #79

craigstanton opened this issue Nov 14, 2024 · 1 comment

Comments

@craigstanton
Copy link

In this basic example I am trying to find the sunrise and sunset times for March 1st 2021 in the middle of Alaska

    const toi = createTimeOfInterest.fromDate(new Date(Date.UTC(2021, 2, 1)));
            const loc = {lat: 66.160507, lon: -153.369141, elevation: 0}
            const promiseRise = createSun(toi).getRise(loc);
            const promiseSet = createSun(toi).getSet(loc);
            Promise.all([promiseRise, promiseSet]).then((results: any[]) => {
                console.log('Sunrise', results[0].getDate());
                console.log('Sunset', results[1].getDate());
            })

The output has the two times on different days with the sunrise occurring after sunset

'Sunrise', Tue Mar 02 2021 06:27:08 GMT+1300 (New Zealand Daylight Time)
'Sunset', Mon Mar 01 2021 16:22:15 GMT+1300 (New Zealand Daylight Time)

I can't see any discussion of this in the docs and I had assumed that the returned data would be for the same day (midnight to midnight) as the time provided.

I have experimented with the locations and found that changing from lat = -102 to -103 then sunrise switches from before the sunset to after it


const toi = createTimeOfInterest.fromTime(2021, 3, 1, 0, 0, 0);
const loc = {lat: 66.160507, lon: -102, elevation: 0}

What is the expected behaviour?

@PendalF89
Copy link

Hi, @craigstanton. Same problem for Sydney. Did you find any solution?

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

2 participants