NepaliCalendarModel

class NepaliCalendarModel(val locale: NepaliDateLocale = NepaliDateLocale())(source)

Locale-aware engine behind the pickers: BS↔AD conversion, month details, formatting, and date comparison. This is the workhorse the :ui composables construct and pass down internally.

For application code, prefer the NepaliDateConverter object facade - it exposes the same conversion / formatting / comparison utilities as ready-to-call functions, so you don't need to construct (and thread) a model instance. Reach for NepaliCalendarModel directly only when you want a single instance pinned to one locale.

Constructors

Link copied to clipboard
constructor(locale: NepaliDateLocale = NepaliDateLocale())

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun addOrSubtractDaysToSimpleDate(year: Int, month: Int, dayOfMonth: Int, daysToAdjust: Int): CustomCalendar
Link copied to clipboard
fun compareDates(calendar: CustomCalendar, year: Int, month: Int, dayOfMonth: Int): Int

Compares a CustomCalendar instance with a date represented by the given year, month, and dayOfMonth.

fun compareDates(simpleDate: SimpleDate, year: Int, month: Int, dayOfMonth: Int): Int
Link copied to clipboard
fun convertToEnglishDate(nepaliYYYY: Int, nepaliMM: Int, nepaliDD: Int): CustomCalendar
Link copied to clipboard
fun convertToNepaliCalendar(englishYYYY: Int, englishMM: Int, englishDD: Int): CustomCalendar
Link copied to clipboard
fun formatEnglishDate(year: Int, month: Int, dayOfMonth: Int, dayOfWeek: Int, locale: NepaliDateLocale): String

Formats a English date based on the specified user preferences.

Link copied to clipboard
Link copied to clipboard

Overload function of above formatNepaliDate function without date range validation.

fun formatNepaliDate(year: Int, month: Int, dayOfMonth: Int, dayOfWeek: Int, locale: NepaliDateLocale): String

Formats a Nepali date based on the specified user preferences. (Without validation)

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A fully populated Gregorian CustomCalendar for a date given in the Gregorian calendar.

Link copied to clipboard
fun getEnglishCalendarsInMonth(englishYear: Int, englishMonth: Int): List<CustomCalendar>

Every day of a Gregorian month as a CustomCalendar, in day order.

Link copied to clipboard

The English equivalent of every day of a Nepali month, in day order.

Link copied to clipboard
fun getEnglishMonth(englishYear: Int, englishMonth: Int): MonthCalendar

Grid geometry of a Gregorian month, the counterpart of getNepaliMonth.

Link copied to clipboard
fun getEnglishMonthName(month: Int, language: NepaliDatePickerLang, format: NameFormat = NameFormat.FULL): String
Link copied to clipboard
Link copied to clipboard
fun getNepaliCalendarsInEnglishMonth(englishYear: Int, englishMonth: Int): List<CustomCalendar?>

The Bikram Sambat equivalent of every day of a Gregorian month, in day order, with null for days before the conversion anchor.

Link copied to clipboard
fun getNepaliMonth(nepaliYear: Int, nepaliMonth: Int): NepaliMonthCalendar
Link copied to clipboard
fun getNepaliMonthName(monthOfYear: Int, format: NameFormat, language: NepaliDatePickerLang = locale.language): String
Link copied to clipboard
Link copied to clipboard
fun getTotalDaysInNepaliMonth(year: Int, month: Int): Int
Link copied to clipboard
fun isEnglishDateConvertible(englishYYYY: Int, englishMM: Int, englishDD: Int): Boolean

Whether the given English date has a Bikram Sambat equivalent in the supported table.

Link copied to clipboard
fun localizeNumber(stringToLocalize: String, locale: NepaliDatePickerLang): String
Link copied to clipboard
fun minusNepaliMonths(fromNepaliCalendar: NepaliMonthCalendar, subtractedMonthsCount: Int): NepaliMonthCalendar
Link copied to clipboard
fun nepaliDaysInBetween(startDate: SimpleDate, endDate: SimpleDate): Int
Link copied to clipboard
fun parse(dateString: String): CustomCalendar?

Parses a date string into a CustomCalendar.

Link copied to clipboard

Parses a date string into an English CustomCalendar, the counterpart of parse.

Link copied to clipboard
fun plusNepaliMonths(fromNepaliCalendar: NepaliMonthCalendar, addedMonthsCount: Int): NepaliMonthCalendar