Library Docs

API Reference

Complete function-by-function and type-by-type reference for @wesantal/santali-calendar.

Import

import { SantaliCalendar } from "@wesantal/santali-calendar";

const calendar = new SantaliCalendar();

SantaliCalendar Class

The primary class that integrates the Metonic cycle, Meeus astronomy engine, and Chandradarshan rule.

calendar.getCalendar(year)

Returns the full calendar data for a Santali year with month grids ready for rendering.

getCalendar(year: number): SantaliCalendarYear

Parameters

year—Santali year (e.g. 2026)number
Returns: SantaliCalendarYear
const yearData = calendar.getCalendar(2026);
// {
//   year: 2026,
//   currentMonthIndex: 0,
//   months: [SantaliCalendarMonth, ...],
//   startDate: Date("2026-01-19"),
//   endDate: Date("2027-01-07")
// }
calendar.getMonths(year)

Returns the raw month metadata array for a Santali year.

getMonths(year: number): SantaliMonth[]

Parameters

year—Santali yearnumber
Returns: SantaliMonth[]
const months = calendar.getMonths(2026);
console.log(months[0].name);  // "ᱢᱟᱜᱽ" (Ol Chiki)
console.log(months[0].roman); // "Mag"
console.log(months.length);   // 12 or 13
calendar.getCurrentMonth()

Returns the current Santali month based on today's date.

getCurrentMonth(): SantaliCalendarMonth
Returns: SantaliCalendarMonth
const currentMonth = calendar.getCurrentMonth();
console.log(`${currentMonth.name} (${currentMonth.roman})`);
calendar.getDate(date?)

Converts any JavaScript Date to its corresponding Santali lunar date.

getDate(date?: DateTime): SantaliDate

Parameters

date—Date, string, or number (defaults to now)DateTime
Returns: SantaliDate
const santaliDate = calendar.getDate(new Date("2026-04-14"));
console.log(santaliDate.day);           // Day of the lunar month (1..30)
console.log(santaliDate.month.name);    // "ᱢᱟᱜᱽ"
console.log(santaliDate.month.roman);   // "Mag"
console.log(santaliDate.weekDay);       // English weekday
console.log(santaliDate.isPurnima);     // true if Full Moon day
console.log(santaliDate.isAmavasya);    // true if New Moon day
calendar.getToday()

Returns today's Santali date.

getToday(): SantaliDate
Returns: SantaliDate
const today = calendar.getToday();
console.log(`${today.day} ${today.month.name}`);
calendar.isLeapYear(year)

Returns true if the Santali year has 13 months (Sarcha Chando) according to the Metonic cycle.

isLeapYear(year: number): boolean

Parameters

year—Santali yearnumber
Returns: boolean
calendar.isLeapYear(2026); // true
calendar.isLeapYear(2027); // false
calendar.isLeapYear(2029); // true
calendar.getDaysInMonth(year, month)

Returns the number of days in a specific Santali month (1-indexed).

getDaysInMonth(year: number, month: number): number

Parameters

year—Santali yearnumber
month—Month number (1-12, or 1-13 in leap years)number
Returns: number
calendar.getDaysInMonth(2026, 1); // Days in Mag Bonga
calendar.getMonthIndex(date)

Returns the 0-based month index for a given date.

getMonthIndex(date: DateTime): number

Parameters

date—Date, string, or numberDateTime
Returns: number — 0-based index (0-11 normal, 0-12 leap)
const idx = calendar.getMonthIndex(new Date()); // 0-12
calendar.getCalendarMonthIndex(date)

Returns the 0-based month index using the 17:00 IST calendar day boundary.

getCalendarMonthIndex(date: DateTime): number

Parameters

date—Date, string, or numberDateTime
Returns: number — 0-based index
const idx = calendar.getCalendarMonthIndex(new Date());
calendar.getMonthFromDate(date)

Returns the Santali month data for a given date.

getMonthFromDate(date: DateTime): SantaliCalendarMonth

Parameters

date—Date, string, or numberDateTime
Returns: SantaliCalendarMonth
const month = calendar.getMonthFromDate(new Date("2026-06-15"));
console.log(month.name);
calendar.getFestivals(year)

Returns all resolved Santali festivals for a given year. Each festival's date is computed based on its rule (fixed Gregorian or moon-relative).

getFestivals(year: number): SantaliFestival[]

Parameters

year—Santali yearnumber
Returns: SantaliFestival[]
const festivals = calendar.getFestivals(2026);
festivals.forEach((f) => {
  console.log(`${f.roman}: ${f.date.toLocaleDateString()}`);
  console.log(`  Type: ${f.type}`);
  console.log(`  Month: ${f.monthId}`);
});

// Example output:
// Santali New Year: 1/19/2026
//   Type: observance
//   Month: MAG
// Mag Bonga: 1/23/2026
//   Type: festival
//   Month: MAG

Astronomy Functions

Low-level astronomical calculation functions exported from the library.

getNewMoon(k)

Meeus Chapter 49 New Moon calculation. Returns Unix milliseconds UTC.

getNewMoon(k: number): number

Parameters

k—Meeus lunation indexnumber
Returns: number — Unix milliseconds UTC
const nm = getNewMoon(285); // Magh 2023 New Moon\nconsole.log(new Date(nm));
getFullMoon(k)

Meeus Chapter 49 Full Moon calculation. Returns Unix milliseconds UTC.

getFullMoon(k: number): number

Parameters

k—Meeus lunation indexnumber
Returns: number — Unix milliseconds UTC
getFullMoonBetween(startMs, endMs)

Find the Full Moon timestamp between two given instants.

getFullMoonBetween(startMs: number, endMs: number): number | null

Parameters

startMs—Start timestamp (ms)number
endMs—End timestamp (ms)number
Returns: number | null — Unix milliseconds UTC
getChandradarshan(newMoonMs)

Apply the 17:00 IST cutoff to determine the actual month start date from an astronomical New Moon.

getChandradarshan(newMoonMs: number): number

Parameters

newMoonMs—Astronomical New Moon (Unix ms UTC)number
Returns: number — Chandradarshan date (Unix ms UTC)
isSantaliLeapYear(year)

Pure mathematical leap year check using the Metonic cycle. No astronomy overhead.

isSantaliLeapYear(year: number): boolean

Parameters

year—Santali yearnumber
Returns: boolean
isSantaliLeapYear(2032); // true
getSantaliMonths(year)

Returns all Santali months for a year with computed start/end dates, full moon, and new moon.

getSantaliMonths(year: number): SantaliMonth[]

Parameters

year—Santali yearnumber
Returns: SantaliMonth[]
getSantaliMonth(date?)

Returns the Santali month for a given date.

getSantaliMonth(date?: DateTime): SantaliMonth

Parameters

date—Date (defaults to now)DateTime
Returns: SantaliMonth
getNewMoonsForYear(year)

Returns all astronomical New Moons for a Gregorian year.

getNewMoonsForYear(year: number): number[]

Parameters

year—Gregorian yearnumber
Returns: number[] — Array of Unix ms UTC
getFullMoonsForYear(year)

Returns all astronomical Full Moons for a Gregorian year.

getFullMoonsForYear(year: number): number[]

Parameters

year—Gregorian yearnumber
Returns: number[] — Array of Unix ms UTC
toISTDate(ms)

Convert a UTC timestamp to an IST Date.

toISTDate(ms: number): Date

Parameters

ms—Unix milliseconds UTCnumber
Returns: Date — IST Date
unixMsToJulianDay(ms)

Convert Unix milliseconds to Julian Day Number.

unixMsToJulianDay(ms: number): number

Parameters

ms—Unix milliseconds UTCnumber
Returns: number — Julian Day Number

Sun Utilities

NOAA-based solar calculation functions for sunrise, sunset, and day length.

getSunriseSunset(date, latitude, longitude, utcOffsetHours?)

Returns sunrise, sunset, solar noon, and day length for a given date and location.

getSunriseSunset(
  date: DateTime,
  latitude: number,
  longitude: number,
  utcOffsetHours?: number
): SunTimes | null

Parameters

date—Date to computeDateTime
latitude—Latitude (North positive)number
longitude—Longitude (East positive)number
utcOffsetHours—UTC offset (default: 5.5 for IST)number
Returns: SunTimes | null — { sunrise, sunset, solarNoon, dayLengthMs }
const sun = getSunriseSunset(
  new Date(),
  23.3441, // Ranchi latitude
  85.3096, // Ranchi longitude
  5.5      // IST
);
console.log(sun?.sunrise);
console.log(sun?.sunset);
console.log(sun?.dayLengthMs);
getSunrise(date, latitude, longitude, utcOffsetHours?)

Returns only the sunrise time.

getSunrise(
  date: DateTime,
  latitude: number,
  longitude: number,
  utcOffsetHours?: number
): Date | null
Returns: Date | null
getSunset(date, latitude, longitude, utcOffsetHours?)

Returns only the sunset time.

getSunset(
  date: DateTime,
  latitude: number,
  longitude: number,
  utcOffsetHours?: number
): Date | null
Returns: Date | null
getBhubaneswarSunriseSunset(date?)

Convenience method for sunrise/sunset in Bhubaneswar, Odisha.

getBhubaneswarSunriseSunset(date?: DateTime): SunTimes | null
Returns: SunTimes | null

Date Utilities

General-purpose date manipulation functions.

Available date utilities include:

toDatecloneDateisValidDateformatDateformatDateStringformatnowtodaygetYeargetMonthgetDaygetDayOfWeekaddDaysaddMonthsaddYearssubDayssubMonthssubYearsdiffInDaysdifferenceInCalendarDaysstartOfDaystartOfWeekstartOfMonthendOfDayendOfWeekendOfMonthisSameDayisSameMonthisTodayisBeforeisAfterisWeekendeachDayOfIntervaleachMonthOfIntervalparseISOcreateDateformatIST

Numeral Conversion

toOlChikiNumeral(n)

Converts an Arabic numeral to Ol Chiki script digits.

toOlChikiNumeral(n: number): string

Parameters

n—An integernumber
Returns: string — Ol Chiki numeral
toOlChikiNumeral(1);    // "᱑"
toOlChikiNumeral(19);   // "᱑᱙"
toOlChikiNumeral(2026); // "᱒᱐᱒᱖"

Constants

SANTALI_MONTHS

SantaliBaseMonth[] — Array of 13 month definitions (12 regular + Sarcha Chando) with Ol Chiki names and English names.

METONIC_CYCLE_START

2026 — Anchor year for the current Metonic cycle.

METONIC_LEAP_POS

Set([1, 4, 7, 9, 12, 15, 18]) — Leap year positions within the 19-year cycle.

IST_OFFSET_MS

19800000 — Indian Standard Time offset in milliseconds (5.5 hours).

weekDays

readonly string[] — English weekday names: ["Sunday", "Monday", ..., "Saturday"].

santaliWeekDays

readonly string[] — Ol Chiki weekday names: ["ᱥᱤᱸᱜᱤ", "ᱚᱛᱮ", ..., "ᱧᱩᱦᱩᱢ"].

santaliFestivals

SantaliFestivalDefination[] — Raw festival definitions with moon-relative and fixed Gregorian rules.

Types

// Core types
type DateTime = Date | string | number;

interface SantaliMonth {
  index: number;
  name: string;       // Ol Chiki name
  roman: string;      // English name
  isLeapMonth: boolean;
  startDate: Date;
  endDate: Date;
  displayEndDate: Date;
  totalDays: number;
  newMoon: Date;
  fullMoon: Date;
}

interface SantaliDate {
  day: number;
  date: Date;
  weekDay: string;
  month: SantaliMonth;
  isPurnima: boolean;
  isAmavasya: boolean;
  isLeapMonth: boolean;
}

// Calendar types
interface SantaliCalendarYear {
  year: number;
  currentMonthIndex: number;
  months: SantaliCalendarMonth[];
  startDate: Date;
  endDate: Date;
}

interface SantaliCalendarMonth extends SantaliMonth {
  days: SantaliCalendarDayCell[];
}

interface SantaliCalendarDayCell {
  day: number;
  date: Date;
  olchiki: string;
  weekDay: string;
  santaliWeekDay: string;
  isToday: boolean;
  isNewMoonDay: boolean;
  isFullMoonDay: boolean;
  isCurrentMonth: boolean;
}

// Festival types
type SantaliFestivalType =
  | "festival"
  | "birth-anniversary"
  | "death-anniversary"
  | "cultural"
  | "community"
  | "observance";

type MoonPhase = "new-moon" | "full-moon";

interface SantaliFestival {
  id: string;
  name: string;
  roman: string;
  monthId: string;
  type: SantaliFestivalType;
  description?: string;
  date: Date;
}

// Sun types
interface SunTimes {
  sunrise: Date;
  sunset: Date;
  solarNoon: Date;
  dayLengthMs: number;
}