GreenCal - agricultural sun & moon calendar, pure Elixir, zero dependencies

Sun and moon calendar for agricultural/gardening use cases — pure Elixir, zero dependencies, no NIF, no external ephemeris data file.

From a geolocation and a date (or date range), GreenCal computes:

  • sunrise, solar noon, sunset, day length, civil dawn/dusk
  • moonrise, moonset, phase, illuminated fraction, distance
  • the three independent lunar cycles agricultural calendars track: waxing/waning (illumination), ascending/descending (declination — the one biodynamic sowing calendars care about), and perigee/apogee (distance)
  • lunar node crossings, the days biodynamic calendars mark as unfavorable
  • the sidereal constellation the Moon stands in, with two boundary conventions (equal sidereal / real IAU boundaries, to match printed Maria Thun calendars)

elixir

day = GreenCal.day({48.8566, 2.3522}, ~D[2026-06-21])
day.sun.rise      #=> ~U[2026-06-21 03:46:57Z]
day.moon.phase    #=> :first_quarter
day.moon.trend    #=> :descending

GreenCal.calendar({48.8566, 2.3522}, Date.range(~D[2026-07-01], ~D[2026-07-31]))

Rise/set times, phases and declination trends are astronomy — computed to the minute and checked against published references. Elements, organs and “sowing days” are tradition, not science: GreenCal computes the underlying astronomy faithfully and labels the traditional mapping for what it is.

Built to avoid the ~32MB ephemeris footprint that heavier astro libraries carry, for a use case (a farming calendar) that doesn’t need JPL-grade precision — NOAA solar + Meeus lunar algorithms instead.

MIT.

elixir

{:green_cal, "~> 0.2.0"}
13 Likes