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?
In this basic example I am trying to find the sunrise and sunset times for March 1st 2021 in the middle of Alaska
The output has the two times on different days with the sunrise occurring after sunset
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
What is the expected behaviour?