- Dharmagya
- panchang-ts docs
- Options & Localization
Options & Localization
panchang-ts · v5.0.0 · MIT
Every option accepted by the entry points, English/Hindi localization, timezone handling, and the localized vs machine-readable field convention.
All options
const r = getDailyPanchang(date, loc, {
timezone: 330, // number (UTC offset min) or IANA string — REQUIRED
ayanamsa: 'lahiri', // lahiri | raman | krishnamurti | true-chitra | thirukanitham
language: 'en', // en | hi
masaSystem: 'purnimanta', // purnimanta | amanta
region: 'all', // 21 state slugs + 'nepal' + 'all'
computeEndTimes: true, // false → skip transition searches
sections: undefined, // undefined = all; see Performance
janmaRashi: undefined, // pass to populate r.chandraBalam (else null)
janmaNakshatra: undefined, // pass to populate r.tarabala (else null)
});| Option | Type / values | Default | Effect |
|---|---|---|---|
timezone | number (minutes from UTC) or IANA string | — (required) | the zone the Hindu day and every *Local string is rendered in |
ayanamsa | 'lahiri' | 'raman' | 'krishnamurti' | 'true-chitra' | 'thirukanitham' | 'lahiri' | sidereal zero-point for every longitude-derived value |
language | 'en' | 'hi' | 'en' | every user-facing string |
masaSystem | 'purnimanta' | 'amanta' | 'purnimanta' | which system calendar.chandramasa.name resolves to |
region | FestivalRegion | 'all' | scopes regional festival variants — see Festivals |
computeEndTimes | boolean | true | whether element endTime/startTime transitions are solved |
sections | PanchangSection[] | undefined | narrow the optional blocks — see Performance |
janmaRashi | 0..11 (0 = Mesha) | undefined | populates chandraBalam |
janmaNakshatra | 0..26 (0 = Ashwini) | undefined | populates tarabala |
Timezone
Number (minutes from UTC, e.g. 330 for IST) or an IANA zone name (e.g. 'America/New_York'). IANA strings need Intl, which older Hermes versions lack — pass a number on those targets. DST resolves automatically for IANA zones.
The result echoes what was resolved: result.timezone is { offsetMinutes: 330, zone: 'Asia/Kolkata' } — zone present only when you passed a zone name.
Language
const hi = getDailyPanchang(date, loc, { timezone: 330, language: 'hi' })!;
hi.angas.tithis[0].name; // "कृष्ण चतुर्दशी"
hi.angas.vara.name; // "मंगलवार"
hi.calendar.chandramasa.name; // "माघ"
hi.periods.choghadiya.day[0].name; // "अमृत"
hi.angas.vara.englishName; // "Tuesday" — englishName always EnglishLocalized vs machine-readable fields
Every user-facing string follows language. Where a value is also meaningful to code, the two are separate fields — the stable key never changes with language:
| Machine-readable | Localized display |
|---|---|
festival.key ('diwali') | festival.name (“दिवाली”) |
bhadra.location ('paatal') | bhadra.locationName (“पाताल”) |
eclipse.kind / eclipse.subtype | eclipse.description |
muhurtaScore.factors[].code | muhurtaScore.reasons (English only) |
MuhurtaScore.reasons is diagnostic English and not a stable format; use factors for anything shown to a user or branched on in code. Yoga and karaka names are English/transliterated proper nouns and intentionally not locale-resolved.
