Home > @magiclane/maps-sdk > MapDetails > getSunriseAndSunset

MapDetails.getSunriseAndSunset() method

Returns the sunrise and sunset times (UTC) for the supplied position and reference date.

The returned times are in UTC. Near the poles the sunrise or sunset may fall on a different calendar day; callers should treat these values as UTC instants.

Signature:

static getSunriseAndSunset(coords: Coordinates, time: Date): [Date, Date];

Parameters

Parameter

Type

Description

coords

Coordinates

WGS84 coordinates for the location

time

Date

Reference date/time (used to compute seasonal sunrise/sunset times)

Returns:

[Date, Date]

Tuple where the first element is sunrise (UTC) and the second is sunset (UTC)