Finding the exact second of a solar return
A solar return happens once a year, at the precise instant the Sun returns to its natal longitude. Finding that instant to 10-millisecond precision requires a numerical solver, not a formula.
A solar return chart is cast for the moment the Sun reaches the exact ecliptic longitude it occupied at birth. For someone born with the Sun at 14.731° Aries, the solar return occurs the instant the Sun crosses 14.731° Aries again, which happens within a day or two of their birthday every year. The chart for that precise moment is what matters, not the chart for midnight on their birthday.
The difference matters in practice. The solar return Ascendant, which changes sign roughly every two hours, can shift from one sign to an entirely different one depending on whether you use the exact instant or an approximation rounded to the nearest day. For a product that promises astronomical precision, that is not acceptable.
1. The search window: Julian years, not calendar arithmetic
The first decision is how to narrow the search before handing it to the solver. The naive approach is to look at the user's birth month and day, find the nearest occurrence of that date in the target year, and search around it. This breaks on leap years, on birthdays near solstices where the Sun's speed varies, and on users born on February 29.
The implementation avoids calendar arithmetic entirely. It computes how many Julian years (each exactly 365.25 days) have elapsed since birth, then adds that many days to the birth timestamp to get an approximate date:
const approxYears = targetYear - birthDate.getUTCFullYear()
const approxDate = new Date(
birthDate.getTime() + approxYears * 365.25 * 86_400_000
)
const searchStart = new Date(approxDate.getTime() - 5 * 86_400_000)
return engine.findSunLongitude(natalSunLongitude, searchStart, 10)
The search window opens 5 days before that approximation and closes 10 days after it. The Sun moves about 1 degree per day, so a 15-day window comfortably brackets the true return regardless of leap-year drift or calendar edge cases.
2. The solver: bisection with quadratic acceleration
Inside the search window, the problem is to find the zero of a function: f(t) = sun_longitude(t) - natal_longitude. At the start of the window this is negative (the Sun has not yet reached the target). At the end it is positive. Somewhere in between it crosses zero.
The solver used is not pure bisection and not Newton's method. It is bisection accelerated by quadratic interpolation, from the astronomy-engine library:
function SearchSunLongitude(targetLon, dateStart, limitDays) {
function sun_offset(t) {
let pos = SunPosition(t)
return LongitudeOffset(pos.elon - targetLon)
}
let t1 = MakeTime(dateStart)
let t2 = t1.AddDays(limitDays)
return Search(sun_offset, t1, t2, { dt_tolerance_seconds: 0.01 })
}
LongitudeOffset normalizes the signed difference to the range (-180, 180], which keeps the function well-behaved when the target longitude is near 0° and the Sun's position wraps from 359° to 1°.
At each iteration, Search fits a parabola through three points (the bracket endpoints and their midpoint), then checks whether the parabola has a root inside the bracket. If it does, and if the root is a good enough approximation, the solver jumps there instead of bisecting. Otherwise it falls back to standard bisection. This converges much faster than bisection alone on smooth functions like solar longitude.
Convergence in practice: pure bisection over a 10-day window would need log2(10 days / 0.01 seconds) = roughly 26 iterations. The quadratic acceleration typically reaches the tolerance in well under 20 iterations. The iteration limit is 20.
3. Precision: 10 milliseconds, 0.0001 degrees
The solver terminates when the bracket half-width is less than 0.01 seconds (10 milliseconds). At the Sun's mean ecliptic speed of about 1 degree per day, 10 milliseconds of time corresponds to roughly 1.7 milliarcseconds of arc. The search is finding the Sun's position to a precision that no traditional astrological software specifies.
The test suite verifies the full pipeline. It calls getSolarReturnDate for a known birth date, then checks the Sun's longitude at the returned timestamp:
const diff = Math.abs(sunAtReturn.longitude - natalSun.longitude)
expect(Math.min(diff, 360 - diff)).toBeLessThan(0.0001)
0.0001° is 0.36 arcseconds. The Math.min(diff, 360 - diff) handles the wrap correctly: a Sun at 359.9999° and a natal longitude of 0.0001° are 0.0002° apart, not 359.9998° apart.
4. UTC enforcement and location independence
The solar return timestamp is in UTC. Every method in the astronomy provider validates that the date string ends in Z before passing it to the engine. This is not optional: mixing local time with sidereal time calculations silently produces wrong coordinates.
The solar return chart is then cast for the user's current location, not their birth location. The birth date determines when the return occurs (the timestamp). The current location determines which Ascendant and house cusps appear in the chart for that moment. These are two separate inputs, and the function signature keeps them separate on purpose.