/** * Finds the year of this epoch * @return float */ protected function getYear() { $year = 0; if ($this->type == YearType::Besselian()) { $year = 1900 + ($this->jd - Epoch::B1900()->jd) / static::DaysBesselianYear; } else { $year = 2000 + ($this->jd - Epoch::J2000()->jd) / static::DaysJulianYear; } return round($year, 6); }
/** * @covers Marando\AstroDate\Epoch::toDate */ public function testToDate() { $dt = Epoch::J2000()->toDate(); $expected = AstroDate::jd(2451545.0, TimeScale::TT()); $this->assertEquals($expected->toJD(), $dt->toJD()); }