hayley-ssg-template

A minimal Dioxus 0.7 starter with SSG + mise + Tailwind.

Sun (solar-positioning)

Sunrise, sunset, and time since/until the last or next event using solar-positioning (SPA). High-latitude polar day and polar night are explicit.

Sun demo uses the shared location store. Coordinates come from whichever provider is active (see Manage location).

No active location yet — open Manage location and refresh a provider.

SSG & hydration

Build / SSG: Preset buttons and copy are static. Live sun times and countdowns call Utc::now() inside use_effect and use_interval — same pattern as the Chrono demo and nav UTC clock.

No default location: Fields start empty until you choose a preset, Fill from active location, or type coordinates. Refresh providers on Manage location.

Library: Calculations run in src/solar/ (wrapper around spa::sunrise_sunset_for_horizon). Twilight, golden hour, and vitamin-D windows are stubbed for later phases.

Location & timezone

Sun times use the local calendar day in your IANA timezone (e.g. Europe/Oslo). SPA anchors each day near local noon.

Refresh providers or pin active on Manage location.

Enter valid coordinates and a timezone to see sun times below.

Today (live, after hydration)

Updates every second via use_interval. Uses Utc::now() only here — not in the static SSG body.

Waiting for hydration…

Tips

  • Crate: solar-positioning (NREL SPA). Do not use the older standalone spa crate.
  • Southern polar: Antarctic (McMurdo) — polar night around local mid-winter (June), polar day around mid-summer (December). Mid-latitude south (e.g. Auckland) always has a sunrise and sunset each calendar day.
  • Polar cases map to SunriseResult::AllDay / AllNightDayKind::PolarDay / PolarNight in src/solar/mod.rs.
  • “Since last” / “until next” walk up to 400 local days when the sun does not rise or set — needed for months-long polar seasons.
  • Phase 2: Horizon::CivilTwilight and Horizon::Custom in src/solar/horizons.rs. Phase 3: vitamin_d_window in src/solar/vitamin_d.rs.
  • Compare mid-latitude results with the NOAA Solar Calculator (within ~1–2 minutes).

Built with Dioxus. Static output goes to target/dx/<app>/release/web/public/.