Skip to content

Kotlin and Java

Bikram Sambat for Kotlin, Java and Android. Neither java.time, ThreeTen-Extra, ICU4J nor android.icu has a Bikram Sambat calendar.

Artifact Contains Depends on
io.github.sanamhub:nepdate Conversion, formatting, parsing, arithmetic, fiscal year kotlin-stdlib
io.github.sanamhub:nepdate-patro Tithi, public holidays and events, BS 2077-01-01 to 2084-08-20 nepdate

Both run on any JVM 11 or later and on Android API 21 or later without desugaring.

build.gradle.kts
dependencies {
implementation("io.github.sanamhub:nepdate:0.1.0-beta.1")
implementation("io.github.sanamhub:nepdate-patro:0.1.0-beta.1") // only for tithi, holidays, events
}

Every file on Maven Central is signed by the release key 44ED6E4129D97536CAE086175B979A307721A17B.

val date = NepaliDate.of(2081, 4, 15)
val fromAd = NepaliDate.ofGregorian(2024, 7, 30)
val longForm = date.toLongString(lang = Lang.NEPALI)
val parsed = NepaliDate.parseLenient("15 Shrawan 2080")
val tithi = date.calendarInfo.tithi

NepaliDate.ofGregorian(2024, 7, 30) is BS 2081-04-15. toLongString in Nepali gives साउन १५, २०८१; parseLenient accepts month names such as 15 Shrawan 2080. The calendarInfo Kotlin extension, from nepdate-patro, is Patro.info in Java.

Topic Where
Every public type and function docs/API.md
Speed, allocations and size, with the C# baseline docs/benchmarks.md
What changed CHANGELOG.md
Source sanamhub/nepdate-kotlin