Self-hosted and self-sufficient function that gives you sunrise and sunset times for a date and location.
GET /?date=2026-06-21&lat=52.52&lng=13.405&timezone=Europe/BerlinParams:
| Param | Required | Description |
|---|---|---|
date |
yes | e.g. 2026-06-21 |
lat |
yes | Latitude |
lng |
yes | Longitude |
timezone |
no | Defaults to UTC |
Response:
{
"timezone": "Europe/Berlin",
"sunrise": "04:43",
"sunset": "21:33"
}It approximates the sun's declination through the year and basically figures out when your spot on Earth rotates into/out of sunlight.
Made for Bunny, but works anywhere that runs JS with Request/Response. Just upload index.js.
MIT © Kamil Wolter