Repository navigation
feat(site): when the sun, its pillar and the moon next show, and refraction - #5
Merged
Merged
Conversation
For its leap-second table (`taiMinusUtc` in `@northguild/gmt/timescale`), which the sky uses for terrestrial time.
The glass blur was 24px, which hid the stars and constellation lines behind the header and library cards entirely. At 4px they show through, softened. The lines already sit under both (z-index -1).
Terrestrial time was 32.184 s plus a hard-coded 37 leap seconds. It now reads TAI − UTC from gmt's leap-second table (`taiMinusUtc`), and the Julian-day conversion takes the length of a day from `totalDuration`, so the sky has no time constants of its own. Positions are unchanged.
Near the horizon the air lifts what is seen by up to half a degree, and the sky drew everything at its true (geometric) position. Found by comparing with baldurpan.com, which computes when the sun clears Ísafjörður's mountains. - `refraction()` and `lift()` in aurora.sky.ts use NOAA's formula, the same one baldurpan.com uses; it matches astronomy-engine's "normal" refraction to within 0.1′ from 0° to 30°. - The sun and moon are drawn lifted; stars and planets are lifted in the star shader. Eclipse geometry keeps the true directions. - The sun now shows from its upper limb on the horizon as it is seen, so the shader's fade-in and the tooltip's threshold move to match. - Tooltips and constellation lines follow the lifted stars and planets; lines run along the true great circle, each point lifted as drawn.
The sky panel now lists, for each site, when the sun, the solar halo or pillar, and the moon next show in this window, with sun, halo and phase-drawn moon icons and the moon's phase and how much of it is lit. - Truly visible only: any part of the disc, in frame and above the skyline (mountains, or buildings for Helsinki), tested at the centre and 16 points round the rim. The skyline is interpolated as the ridge mesh is drawn. The sun counts from half its drawn strength. - Solar halo / pillar counts the pillar (2° of it at least), or a quarter of the 22° ring while the disc also shows: the ring alone is drawn too faintly to see, and not at all over the aurora. - aurora.ahead.ts steps ahead a minute at a time near the frame and skips ahead while a body is far (nothing moves faster than about 16° an hour), then halves each edge to 10 s. About 0.1 s for both sites, in slices between frames in the worker; nothing runs on the page. - Worked out fresh when the panel opens (and from a hover or focus on its button), and again while it is open when a spell starts or ends, after local midnight, at least hourly, on resize and when the tab returns. - All time through @northguild/gmt: the clock, `addUnix`, `roundUnix`, `endOfUnix`, `areUnixEqualBy`, `totalDuration`, `formatCalendarUnix` and `formatUnix` in the visitor's zone, named from `getSystemTimeZone`. - Checked against astronomy-engine and by screenshots before, during and after predicted spells.
A quiet footer under the credits: "Site runs on @northguild/gmt vX.Y.Z", linking to the GMT docs. The version is read from the installed package at build time, so it follows every upgrade; gmt does not export its package.json, so it is imported by path and only the string reaches the page.
baldurpan
reviewed
Oct 23, 2026
baldurpan
left a comment
There was a problem hiding this comment.
This is careful work. The look-ahead's skip-ahead bound holds, every gmt call is right for 1.20.0, and refraction is applied in the right places: true directions for eclipses and the constellation great circles, lifted directions for drawing and picking. CI is green.
Four comments inline:
aurora.worker.ts: the pillar test. This one changes what the panel says. The halo row can report a pillar that the shader draws at a few percent of its strength.aurora.ahead.ts: locale. The day phrase is in the browser's language, but the sentence around it is in English.Aurora.astro:focushas no matchingblur. After keyboard focus, the search keeps re-running.aurora.sky.ts: a doc comment on the wrong function. A nit.
From review: the pillar test sampled up to 6° above a sun as high as 6°, where the shader draws the pillar at a few percent, so the halo row could report a pillar nobody can see. It now matches the sun's half-strength rule: a sun below y = 0.07 (about 4°, where the shader's 1 - smoothstep(0.03, 0.11, y) is a half) and only the 2° just above it (exp(-dAlt / 0.05) is a half at 2°), with at least 1° of that showing.
From review: the dates were formatted in the browser's language inside English sentences, so a German browser got "In view now, until morgen um 02:10". They now use the visitor's first English locale (keeping their 12- or 24-hour clock), else British English. The time zone is still theirs.
From review: focus on the info button started the sun and moon search, but only pointerleave stopped it, so a keyboard visitor tabbing past the button left the worker re-running a year-long search for the rest of the visit. blur now stops it too, with the same guard, so focus moving into the open popover keeps it.
From review: the look-ahead helper's doc sat on top of sunRadiusAt's. It now sits on sunAndMoon and mentions the lifted directions and radii. The sun's distance moves into sunDistance(), which sunRadiusAt() and sky() both use, instead of sky() working the radius out again.
baldurpan
approved these changes
Oct 23, 2026
baldurpan
left a comment
There was a problem hiding this comment.
Approved at dbc5ae5. All four review points are fixed: the pillar counts only where it is drawn at half strength, the dates are in English in the visitor's time zone, tabbing past the button stops the search, and the doc is on sunAndMoon. CI is green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The sky panel (the ⓘ button) now says, for each site, when the sun, the solar halo or pillar, and the moon next show in this window. The sky also accounts for atmospheric refraction now.
What it shows
Only what is truly visible
Refraction
Comparing with baldurpan.com (sun over Ísafjörður's mountains) showed the sky drew everything at its true position. Near the horizon the air lifts what you see by up to half a degree, and every sun or moon peek here is low over a ridge. The sun, moon, planets and stars are now lifted with NOAA's formula, the one baldurpan.com uses, which matches astronomy-engine within 0.1′. Eclipse geometry keeps the true directions.
gmt
Dateanywhere in the repo. All clock reading, date arithmetic and formatting go through@northguild/gmt.taiMinusUtc(leap seconds for terrestrial time).Also
Checked
oxfmt --check,oxlintandastro check, and the last one also builds.