The regular sunrise and sunset hours work well if the location is on a plain surface without mountains. So, the solution is to use a fixed offset to be more precise. However, offsets can vary depends on the period of the year. With PeakFinder, you can precisely determine the time of a sunset and a sunrise, according to the mountains next to the given location.
For example, Sion (in Switzerland) is surrounded of mountains. On 22nd May 2025, the official forecast indicates a sunrise at 05:49 AM and a sunset at 21:05. For the same date, PeakFinder takes into account the mountains and says a sunrise at 06:21 and a sunset at 19:57.
PeakFinder has an API for the sun times : GitHub - Fabiz/PeakFinder-API: Demo Page form embedding the PeakFinder API