luc-nham / lunar-calendar

PHP Lunar Calendar
MIT License
6 stars 1 forks source link

Convert Julian day number to Lunar new moon incorrect #47

Closed luc-nham closed 1 month ago

luc-nham commented 1 month ago

Describe In some case, when Julian day number input is a local midnight that equal with Julian day number at midnight of expect New moon phase, the output returns the previous New moon cycle.

Details

<?php

namespace LucNham\LunarCalendar\Tests\Converters;

use LucNham\LunarCalendar\Converters\JdToLunarNewMoon;
use PHPUnit\Framework\TestCase;

class JdToLunarNewMoonTest extends TestCase
{
    public function testError()
    {
        $offset = 25200;        // GMT+7
        $jd = 2415050.208333;   // 1900-01-30T17:00+0000 | 1900-01-31T00:00+0700

        $converter = new JdToLunarNewMoon($jd, $offset);
        $newmoon = $converter->getOuput();

        $this->assertEquals(1, $newmoon->total);
        $this->assertEquals(2415050.2083333, $newmoon->jd);
    }
}