Skip to content

nepali-calendar-engine


nepali-calendar-engine / getPanchang

Function: getPanchang()

getPanchang(date, options?): PanchangInfo | null

Defined in: panchang/panchang-lookup.ts:90

Returns panchang data for a given date.

  • Accepts either a Gregorian Date or a BSDate.
  • options can specify a custom observer location (lat/lon).

Fast path (precomputed data): used when the year is in the precomputed range (BS 2080–2090) and no custom location is provided. Call ensurePanchangYear() before bulk queries to avoid async gaps.

Fallback path (live computation): used when the year is outside the precomputed range OR a non-Kathmandu location is requested. Falls back to computePanchang() (astronomy-engine, JPL-validated). Results are LRU-cached per session.

Returns null only if the date is entirely outside the supported BS calendar range (BS 2000–2090) or if computation fails.

Parameters

date

BSDate | Date

options?

FallbackOptions

Returns

PanchangInfo | null