NepaliEventProvider

Service-provider interface for supplying a calendar's events: public holidays, festivals, programmes, anything an app wants named on a day.

This library ships no data by design. Nepali holiday lists change year to year and every institution keeps its own, so nothing here could be right for long. Implement this with your own source (a static map, a CMS, an HR API, the Patro paid catalog) and hand it to NepaliCalendarPolicy.

Implementations must:

Example:

object MyEvents : NepaliEventProvider {
private val byYear: Map<Int, Set<NepaliCalendarEvent>> = mapOf(
2082 to setOf(
NepaliCalendarEvent(SimpleDate(2082, 1, 1), "नयाँ वर्ष", NepaliEventKind.GovernmentPublic),
// …
)
)
override fun events(year: Int): Set<NepaliCalendarEvent> = byYear[year].orEmpty()
}

The reference paid implementation is dev.shivathapaa.patro:patro-calendar, which ships curated holiday and festival data alongside its inline calendar UI.

Inheritors

Functions

Link copied to clipboard
open fun closesOn(date: SimpleDate): Boolean

Whether the institution is shut on date, which is what the working-day helpers count by.

Link copied to clipboard
abstract fun events(year: Int): Set<NepaliCalendarEvent>

Everything named in year, Bikram Sambat. An empty set is a valid answer.

Link copied to clipboard

A view of this provider carrying only the entries predicate accepts, for narrowing a shared list to what one screen cares about: filtered { it.kind == NepaliEventKind.GovernmentPublic }.

Link copied to clipboard

A provider reporting everything either side reports, which is how a national list and an institution's own list are put together.