
Calculates astronomical times, sunrise/sunset (NOAA default), and Jewish zmanim for prayers; offers ComplexZmanimCalendar, lazy computed zman properties, metadata-rich definitions, and an allZmanim list.
The KosherKotlin Zmanim library is a Kotlin Multiplatform API for a specialized calendar that can calculate different astronomical times including sunrise and sunset (default uses NOAA's algorithm) and Jewish zmanim or religious times for prayers and other Jewish religious duties.
It is based on Eliyahu Hershfeld's KosherJava.
For non religious astronomical / solar calculations use the AstronomicalCalendar.
The ZmanimCalendar class contains the most common zmanim or religious time calculations.
For a much more extensive list of zmanim use the ComplexZmanimCalendar.
This class contains the main functionality of the Zmanim library.
For a basic set of instructions on the use of the API, see How to Use the Zmanim API, zmanim code samples and the KosherJava FAQ. See the KosherJava Zmanim site for additional information.
The library is published to Maven Central. Add it to your project:
// build.gradle.kts
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.elfifo4:kosherkotlin:1.0.0")
}The library supports Android, JVM (Desktop), iOS (arm64, x64, simulatorArm64), and JavaScript.
This library is currently a Compose Multiplatform app with a package for the library and a package for the app. The app is a demo of the library, and is not required to use the library.
local.properties file to the project root and set a path to Android SDK thereTo run the application on android device/emulator:
To build the application bundle:
./gradlew :composeApp:assembleDebug
.apk file in composeApp/build/outputs/apk/debug/composeApp-debug.apk
Run the desktop application: ./gradlew :composeApp:run
To run the application on iPhone device/simulator:
iosApp/iosApp.xcproject in Xcode and run standard configurationRun the browser application: ./gradlew :composeApp:jsBrowserDevelopmentRun
The library was designed to be as idiomatic as possible, both in its implementation and its API surface. Every client-facing zero-argument function is accessible as a computed property (e.g. ComplexZmanimCalender().alos72).
Every zman has a lazily computed generic property called value.
Zman.DateBased objects have a momentOfOccurrence property which lazily computes the Instant of the zman's occurrence.
Zman.ValueBased objects have a duration property which lazily computes the Duration of how long the zman lasts.
A lazy list of all zmanim can be accessed using the allZmanim property of ComplexZmanimCalendar or ZmanimCalendar.
Every Zman object has a definition property which contains the metadata of the rules used to calculate the zman.
val location = GeoLocation("New York", 40.7, -74.0, 0.0, TimeZone.of("America/New_York"))
val calendar = ComplexZmanimCalendar(location)
println(calendar.allZmanim.filter { it.definition.type == ZmanType.ALOS }.map { it.value })
println(calendar.sunrise)
println(calendar.alos72.momentOfOccurrence)
println(calendar.shaahZmanis72Minutes.duration)Hosted documentation coming soon!
kotlinx-datetime so that it is multi-platform friendly. This is a major overhaul - PRs are welcomed.io.github.elfifo4:kosherkotlin
This section is for maintainers.
~/.gradle/gradle.properties must contain:
mavenCentralUsername=<token from central.sonatype.com → View Account → Generate User Token>
mavenCentralPassword=<token password>
signingInMemoryKey=<GPG private key as a single line with \n separators>
signingInMemoryKeyPassword=<GPG key passphrase>To convert your GPG private key to the required single-line format:
awk '{printf "%s\\n", $0}' ~/private-key.ascversion in library/build.gradle.kts
git tag v1.0.0
git push origin v1.0.0./gradlew :library:publishAndReleaseToMavenCentral --no-configuration-cachehttps://repo1.maven.org/maven2/io/github/elfifo4/kosherkotlin/
# Verify JARs and POM are generated correctly
./gradlew :library:publishToMavenLocal
# Inspect output
find ~/.m2/repository/io/github/elfifo4 -name "*.pom" | sortThe library is released under the LGPL 2.1 license. If you made a publicly-available program that uses this library, I want to know! Just send me a heads-up email at "software at sternbach.org".
While I did my best to get accurate results, please double check before relying on these zmanim for halacha lemaaseh.
The KosherKotlin Zmanim library is a Kotlin Multiplatform API for a specialized calendar that can calculate different astronomical times including sunrise and sunset (default uses NOAA's algorithm) and Jewish zmanim or religious times for prayers and other Jewish religious duties.
It is based on Eliyahu Hershfeld's KosherJava.
For non religious astronomical / solar calculations use the AstronomicalCalendar.
The ZmanimCalendar class contains the most common zmanim or religious time calculations.
For a much more extensive list of zmanim use the ComplexZmanimCalendar.
This class contains the main functionality of the Zmanim library.
For a basic set of instructions on the use of the API, see How to Use the Zmanim API, zmanim code samples and the KosherJava FAQ. See the KosherJava Zmanim site for additional information.
The library is published to Maven Central. Add it to your project:
// build.gradle.kts
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.elfifo4:kosherkotlin:1.0.0")
}The library supports Android, JVM (Desktop), iOS (arm64, x64, simulatorArm64), and JavaScript.
This library is currently a Compose Multiplatform app with a package for the library and a package for the app. The app is a demo of the library, and is not required to use the library.
local.properties file to the project root and set a path to Android SDK thereTo run the application on android device/emulator:
To build the application bundle:
./gradlew :composeApp:assembleDebug
.apk file in composeApp/build/outputs/apk/debug/composeApp-debug.apk
Run the desktop application: ./gradlew :composeApp:run
To run the application on iPhone device/simulator:
iosApp/iosApp.xcproject in Xcode and run standard configurationRun the browser application: ./gradlew :composeApp:jsBrowserDevelopmentRun
The library was designed to be as idiomatic as possible, both in its implementation and its API surface. Every client-facing zero-argument function is accessible as a computed property (e.g. ComplexZmanimCalender().alos72).
Every zman has a lazily computed generic property called value.
Zman.DateBased objects have a momentOfOccurrence property which lazily computes the Instant of the zman's occurrence.
Zman.ValueBased objects have a duration property which lazily computes the Duration of how long the zman lasts.
A lazy list of all zmanim can be accessed using the allZmanim property of ComplexZmanimCalendar or ZmanimCalendar.
Every Zman object has a definition property which contains the metadata of the rules used to calculate the zman.
val location = GeoLocation("New York", 40.7, -74.0, 0.0, TimeZone.of("America/New_York"))
val calendar = ComplexZmanimCalendar(location)
println(calendar.allZmanim.filter { it.definition.type == ZmanType.ALOS }.map { it.value })
println(calendar.sunrise)
println(calendar.alos72.momentOfOccurrence)
println(calendar.shaahZmanis72Minutes.duration)Hosted documentation coming soon!
kotlinx-datetime so that it is multi-platform friendly. This is a major overhaul - PRs are welcomed.io.github.elfifo4:kosherkotlin
This section is for maintainers.
~/.gradle/gradle.properties must contain:
mavenCentralUsername=<token from central.sonatype.com → View Account → Generate User Token>
mavenCentralPassword=<token password>
signingInMemoryKey=<GPG private key as a single line with \n separators>
signingInMemoryKeyPassword=<GPG key passphrase>To convert your GPG private key to the required single-line format:
awk '{printf "%s\\n", $0}' ~/private-key.ascversion in library/build.gradle.kts
git tag v1.0.0
git push origin v1.0.0./gradlew :library:publishAndReleaseToMavenCentral --no-configuration-cachehttps://repo1.maven.org/maven2/io/github/elfifo4/kosherkotlin/
# Verify JARs and POM are generated correctly
./gradlew :library:publishToMavenLocal
# Inspect output
find ~/.m2/repository/io/github/elfifo4 -name "*.pom" | sortThe library is released under the LGPL 2.1 license. If you made a publicly-available program that uses this library, I want to know! Just send me a heads-up email at "software at sternbach.org".
While I did my best to get accurate results, please double check before relying on these zmanim for halacha lemaaseh.