formatNepaliDate

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

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

Return

A string representing the formatted date according to the user's preferences.

Parameters

year

takes an integer value of year.

month

takes an integer value of month.

dayOfMonth

takes an integer value of day.

dayOfWeek

takes an integer value of day of week.

locale

The NepaliDateLocale specifying the user's preferred language,date format, weekday name format, and month name format.


Overload function of above formatNepaliDate function without date range validation.

Formats a Nepali date based on the specified user preferences with date range validation.

Return

A string representing the formatted date according to the user's preferences.

The function supports the following date format styles:

  • FULL: Monday, Asar 21, 2024 or, सोमबार, असार २१, २०७४

  • LONG: Asar 21, 2024 or, असार २१, २०७४

  • MEDIUM: 2024 Asar 21 or, २०७४ असार २१

  • SHORT_MDY: 06/21/2024 or, ०६/२१/२०७४

  • SHORT_YMD: 2024/06/21 or, २०७४/०६/२१

  • COMPACT_MDY: 06/21/24 or, ०६/२१/२४

  • COMPACT_YMD: 24/06/21 or, २४/०६/२१

The function uses the specified weekday and month name formats to match the user's preferred language and format style.

Example usage:

val nepaliDate = CustomCalendar(year = 2080, month = 3, dayOfMonth = 15, dayOfWeek = 2, ....)
val locale = NepaliDateLocale(
language = NepaliDatePickerLang.ENGLISH,
dateFormat = NepaliDateFormatStyle.FULL,
weekDayName = NameFormat.FULL,
monthName = NameFormat.FULL
)
val formattedDate = formatNepaliDate(nepaliDate, locale)
// formattedDate: "Monday, Asar 11, 2080"

Parameters

customCalendar

The CustomCalendar containing the year, month, day, and weekday.

locale

The NepaliDateLocale specifying the user's preferred language,date format, weekday name format, and month name format.