astronomy-bundle-js icon indicating copy to clipboard operation
astronomy-bundle-js copied to clipboard

Moonset / Moonrise : Difference with TimeAndDate

Open bplace opened this issue 8 months ago • 0 comments

Hi,

I've seen a difference with Time and Date for a location in Sweden, Östersund in June 2024. This happens around days when the moon is up or down the whole day.

On June 9, 2024, TimeAndDate shows a Moonset & a Moonrise on this day, whereas the library respond with the standard error for days without rise.

import {createTimeOfInterest} from 'astronomy-bundle/time/index.js';
import {createMoon} from 'astronomy-bundle/moon/index.js';

const location = {
    lat: 63.179167,
    lon: 14.635833
}

const date = new Date('2024-06-09T00:00:00Z');
const toi = createTimeOfInterest.fromDate(date);
const moon = createMoon(toi);

console.log(`rise:${(await moon.getRise(location)).getDate()}`);
console.log(`set:${(await moon.getSet(location)).getDate()}`);

Returns:

Error: Astronomical object cannot rise on given day 2460470.5. Rise happens the next day.

Another difference, in July 7th, 2024, a moonset happens at 00:38 on Time And Date ; the library will only give the moonrise at 3:39

import {createTimeOfInterest} from 'astronomy-bundle/time/index.js';
import {createMoon} from 'astronomy-bundle/moon/index.js';

const location = {
    lat: 63.179167,
    lon: 14.635833
}

const date = new Date('2024-07-07T00:00:00Z');
const toi = createTimeOfInterest.fromDate(date);
const moon = createMoon(toi);

console.log(`rise:${(await moon.getRise(location)).getDate()}`);
console.log(`set:${(await moon.getSet(location)).getDate()}`);

Returns:

rise:Sun Jul 07 2024 03:40:00 GMT+0200 (Central European Summer Time)
set:Mon Jul 08 2024 00:20:21 GMT+0200 (Central European Summer Time)

Trying on the previous day, we get (with try / catch):

Error: Astronomical object cannot rise on given day 2460497.5. Rise happens the day before.
Error: Astronomical object cannot set on given day 2460497.5. Set happens the day before.

Am I missing something here?

Thank you for this wonderful project, it's really great.

bplace avatar Jun 20 '24 13:06 bplace