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:
return a stable Set for a given year (calling twice should yield the same contents),
be safe to call from the UI thread (a calendar asks once per visible cell, so answer from a memoized source),
not throw for years outside dev.shivathapaa.nepalidatepickerkmp.calendar_model.NepaliCalendarDefaults.NepaliYearRange; return emptySet instead.
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
Whether the institution is shut on date, which is what the working-day helpers count by.
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 }.
A provider reporting everything either side reports, which is how a national list and an institution's own list are put together.