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
fun getEnglishMonthName(month: Int, language: NepaliDatePickerLang, format: NameFormat = NameFormat.FULL): String
Link copied to clipboard
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 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
fun plusNepaliMonths(fromNepaliCalendar: NepaliMonthCalendar, addedMonthsCount: Int): NepaliMonthCalendar