Package-level declarations

Types

Link copied to clipboard

One institution's closed days: the weekdays it never opens plus the holidays it keeps.

Link copied to clipboard

A fully described calendar date in either the Bikram Sambat or Gregorian system.

Link copied to clipboard

The year, month and day recovered by parseBsDateText, with no calendar lookup performed.

Link copied to clipboard

A NepaliDate paired with a NepaliTime. Mirrors the shared CustomDateTime.

Link copied to clipboard

What one day is under a policy.

Link copied to clipboard

One thing on one day: a public holiday, a festival, a programme, a meeting.

Link copied to clipboard

Month-level metadata used to lay out a Bikram Sambat month grid.

Link copied to clipboard

A time of day in the Asia/Kathmandu zone. Mirrors the shared SimpleTime.

Link copied to clipboard
class YearRange

An inclusive year range. Mirrors a Kotlin IntRange.

Functions

Link copied to clipboard

Parse an ISO 8601 timestamp into a Gregorian date and Nepali time.

Link copied to clipboard
fun adDateTimeToIso(year: Int, month: Int, dayOfMonth: Int, hour: Int, minute: Int, second: Int, nanosecond: Int): String

Convert a Gregorian date and Nepali time to an ISO 8601 UTC timestamp.

Link copied to clipboard
fun addDaysToBsDate(year: Int, month: Int, dayOfMonth: Int, daysToAdjust: Int): NepaliDate

Add (or subtract, with a negative value) days to a Bikram Sambat date.

Link copied to clipboard

Parse an ISO 8601 timestamp into a Bikram Sambat date and Nepali time.

Link copied to clipboard
fun bsDateTimeToIso(year: Int, month: Int, dayOfMonth: Int, hour: Int, minute: Int, second: Int, nanosecond: Int): String

Convert a Bikram Sambat date and time to an ISO 8601 UTC timestamp (e.g. "2024-09-09T09:00:15Z").

Link copied to clipboard
fun compareBsDates(year1: Int, month1: Int, day1: Int, year2: Int, month2: Int, day2: Int): Int

Compare two Bikram Sambat dates. Negative if the first is earlier, 0 if equal, positive if later.

Link copied to clipboard
fun convertAdToBs(year: Int, month: Int, dayOfMonth: Int): NepaliDate

Convert a Gregorian (AD) date to its Bikram Sambat (BS) equivalent.

Link copied to clipboard
fun convertBsToAd(year: Int, month: Int, dayOfMonth: Int): NepaliDate

Convert a Bikram Sambat (BS) date to its Gregorian (AD) equivalent.

Link copied to clipboard

A policy over weeklyOffDays (1 for Sunday through 7 for Saturday) and events.

Link copied to clipboard
fun createDetailedEvent(year: Int, month: Int, dayOfMonth: Int, name: String, kind: String, closesOffices: Boolean, id: String?, payload: String?): NepaliEvent

The same as createEvent, with everything the shorter form leaves to its kind spelled out.

Link copied to clipboard
fun createEvent(year: Int, month: Int, dayOfMonth: Int, name: String, kind: String): NepaliEvent

One holiday for createCalendarPolicy.

Link copied to clipboard

event repeated on each of days consecutive days, starting on its own date.

Link copied to clipboard
fun expandEventThrough(event: NepaliEvent, endYear: Int, endMonth: Int, endDayOfMonth: Int): Array<NepaliEvent>

event repeated on each day from its own date through the given end date, both ends included, which is how a published holiday list or a leave request usually states a span.

Link copied to clipboard
fun formatAdDate(year: Int, month: Int, dayOfMonth: Int, dayOfWeek: Int, language: String, dateFormat: String, weekDayName: String, monthName: String, digitScript: String?): String

Format a Gregorian date with a locale preset. See formatBsDate for parameter meanings.

Link copied to clipboard
fun formatAdDateByPattern(pattern: String, year: Int, month: Int, dayOfMonth: Int, language: String): String

Format a Gregorian date with a Unicode-style pattern. The full Gregorian calendar is resolved internally via a round-trip conversion, so day-of-year (D) and week-of-year (w) work.

Link copied to clipboard
fun formatBsDate(year: Int, month: Int, dayOfMonth: Int, dayOfWeek: Int, language: String, dateFormat: String, weekDayName: String, monthName: String, digitScript: String?): String

Format a Bikram Sambat date with a locale preset.

Link copied to clipboard
fun formatBsDateByPattern(pattern: String, year: Int, month: Int, dayOfMonth: Int, language: String): String

Format a Bikram Sambat date with a Unicode-style pattern (e.g. "yyyy-MM-dd EEEE"). The full calendar for the date is resolved internally, so day-of-year (D) and week-of-year (w) work.

Link copied to clipboard
fun formatBsDateText(year: Int, month: Int, dayOfMonth: Int, pattern: String, digitScript: String?): String

Format a Bikram Sambat date as fixed-width text, zero-padded to ten characters.

Link copied to clipboard
fun formatTimeEnglish(hour: Int, minute: Int, second: Int, nanosecond: Int, use12HourFormat: Boolean): String

Format a time of day in English, 12-hour (e.g. "4:30 PM") or 24-hour (e.g. "16:30").

Link copied to clipboard
fun formatTimeNepali(hour: Int, minute: Int, second: Int, nanosecond: Int, use12HourFormat: Boolean): String

Format a time of day in Nepali (e.g. "दिउँसो ४ : ३०").

Link copied to clipboard
fun formatTimeOfDay(hour: Int, minute: Int, second: Int, nanosecond: Int): String

Format a time of day as HH:mm:ss, gaining a .nnnnnnnnn fractional part only when nanosecond is non-zero.

Link copied to clipboard
fun getAdCalendar(year: Int, month: Int, dayOfMonth: Int): NepaliDate

The fully described Gregorian calendar for an AD year / month / day.

Link copied to clipboard

Every day of a Bikram Sambat month as its Gregorian equivalent, in day order.

Link copied to clipboard
fun getAdDaysBetween(startYear: Int, startMonth: Int, startDay: Int, endYear: Int, endMonth: Int, endDay: Int): Int

Days between two Gregorian dates (end exclusive). Add 1 to include the end date.

Link copied to clipboard
fun getAdMonth(year: Int, month: Int): NepaliMonthInfo

Month-grid metadata for a Gregorian year / month.

Link copied to clipboard
fun getAdMonthName(month: Int, format: String, language: String): String

Gregorian month name (1 = January) in the requested format and language.

Link copied to clipboard

Inclusive supported Gregorian year range.

Link copied to clipboard

The Gregorian years a Gregorian-first calendar should offer for a Bikram Sambat year range, so both calendars cover the same span of real days.

Link copied to clipboard
fun getBsCalendar(year: Int, month: Int, dayOfMonth: Int): NepaliDate

The fully described Bikram Sambat calendar for a BS year / month / day.

Link copied to clipboard

Every day of a Gregorian month as its Bikram Sambat equivalent, in day order.

Link copied to clipboard
fun getBsDaysBetween(startYear: Int, startMonth: Int, startDay: Int, endYear: Int, endMonth: Int, endDay: Int): Int

Days between two Bikram Sambat dates (end exclusive). Add 1 to include the end date.

Link copied to clipboard
fun getBsMonth(year: Int, month: Int): NepaliMonthInfo

Month-grid metadata for a Bikram Sambat year / month.

Link copied to clipboard
fun getBsMonthName(month: Int, format: String, language: String): String

Bikram Sambat month name (1 = Baisakh) in the requested format and language.

Link copied to clipboard

Inclusive supported Bikram Sambat year range.

Link copied to clipboard

The current wall-clock time in the Asia/Kathmandu zone.

Link copied to clipboard

Today in the Gregorian calendar, in the Asia/Kathmandu zone.

Link copied to clipboard

Today in the Bikram Sambat calendar, in the Asia/Kathmandu zone.

Link copied to clipboard
fun getTotalDaysInAdMonth(year: Int, month: Int): Int

Total days in a Gregorian month.

Link copied to clipboard
fun getTotalDaysInBsMonth(year: Int, month: Int): Int

Total days in a Bikram Sambat month.

Link copied to clipboard
fun getWeekdayName(dayOfWeek: Int, format: String, language: String): String

Weekday name (1 = Sunday) in the requested format (short / medium / full) and language (en / ne).

Link copied to clipboard
fun isAdDateConvertible(year: Int, month: Int, dayOfMonth: Int): Boolean

Whether a Gregorian date has a Bikram Sambat equivalent.

Link copied to clipboard
fun localizeDigits(text: String, script: String): String

Localize the ASCII digits in text to a numeral script (latin / devanagari). Non-digit characters pass through unchanged.

Link copied to clipboard

Parse fixed-width date text back into its year, month and day, returning null when text is not that pattern.

Link copied to clipboard

Parse HH:mm:ss or HH:mm:ss.nnnnnnnnn text into a time of day, returning null when text is not one of those.

Link copied to clipboard

Convert digits in any supported non-Latin script back to ASCII 0-9.