Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/V3RNE42/helios/llms.txt

Use this file to discover all available pages before exploring further.

The /api/timezone endpoint accepts a latitude and longitude and returns the UTC offset at that location in fractional hours. This is used by Helios to convert solar event times to local clock times when the user enables the “local time” option.

Request

Method: GET
Path: /api/timezone
lat
number
required
Latitude in decimal degrees.
lon
number
required
Longitude in decimal degrees.
curl "https://your-deployment.vercel.app/api/timezone?lat=40.4168&lon=-3.7038"

Response

On success the endpoint returns a JSON object with the UTC offset for the given coordinates.
{ "offset": 1 }
offset
number
UTC offset in hours (e.g. 1 for UTC+1, -5 for UTC-5). Can be fractional for half-hour or quarter-hour zones.
On error, the endpoint returns a non-2xx HTTP status. The front-end detects this via response.ok and throws:
No se pudo obtener el huso horario (<status>)
This error message is caught by the form submit handler and displayed to the user as an alert.

Providers

Primary — ipgeolocation.io
Requires the IPGEOLOCATION_KEY environment variable.
Fallback — TimeZoneDB
Used when the primary provider fails. Requires the TIMEZONEDB_KEY environment variable.

When this endpoint is called

This endpoint is only called when the user has enabled the local time option. When local time is disabled, getOffset is injected as a no-op and the endpoint is never contacted. When local time is enabled, the endpoint is called multiple times per form submission:
  1. Once for the origin coordinates (to compute startOffset) inside checkLocal()
  2. Once for the destination coordinates (to compute endOffset) inside checkLocal()
  3. For each solar event along the route — sunrise position, sunset position, and solar noon position of every day-segment computed by sectionFormatter()
Timezone lookups are skipped entirely when origin and destination share the same UTC offset. In checkLocal(), if startOffset === endOffset, the local-time flag is set back to false and no further offset lookups are made.

Build docs developers (and LLMs) love