リファレンス · 場所から見た太陽と月: 位置、日の出と日の入り、月の出入りと月相。suncalc 2 と同じ名前で、より正確です
getTimes関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The Sun's times for a day at a place.
インポート
import { getTimes } from "@johnmorrisdotca/wakusei-planets/suncalc";
定義
function getTimes(date: Date | number, lat: number, lng: number, height?: number, utcOffset?: number): SunTimes
引数
| 名前 | 型 | 説明 |
|---|---|---|
date | number | Date | Any moment of the day, as a |
lat | number | Degrees north, -90 to 90. |
lng | number | Degrees east (west negative). |
height (省略可) | number | The observer's height above the horizon in metres (default 0): it lowers the sunrise and sunset altitudes by the dip of the horizon. |
utcOffset (省略可) | number | undefined | Minutes east of UTC: when given the day is the local calendar day holding |
戻り値
SunTimes
The times as Dates, null for one that does not happen that day, and alwaysUp or alwaysDown at the poles.
例
import { getTimes } from "@johnmorrisdotca/wakusei-planets/suncalc";
const t = getTimes(new Date(Date.UTC(2026, 5, 21, 12)), 51.5, -0.1, 0, 60);
console.log(t.sunrise!.toISOString().slice(0, 13));2026-06-21T03出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。