JchuDateTime

Multiplatform date and time operations shared by Android and iOS.

Functions that depend on the current time accept explicit Instant and TimeZone values, making them deterministic in tests while retaining useful system defaults.

Functions

Link copied to clipboard
fun calculateAge(birthDate: LocalDate, referenceDate: LocalDate): Int
Link copied to clipboard
fun daysBetween(start: LocalDate, end: LocalDate): Long
Link copied to clipboard
fun daysInMonth(year: Int, month: Int): Int
Link copied to clipboard
fun daysInYear(year: Int): Int
Link copied to clipboard
fun daysOfWeek(firstDayOfWeek: DayOfWeek): List<DayOfWeek>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun isLeapYear(year: Int): Boolean
Link copied to clipboard
fun monthsBetween(start: LocalDate, end: LocalDate): Long
Link copied to clipboard
fun now(): Instant
Link copied to clipboard
fun nowLocal(instant: Instant = now(), timeZone: TimeZone = TimeZone.currentSystemDefault()): LocalDateTime
Link copied to clipboard
fun parseDate(value: String): LocalDate
Link copied to clipboard
fun parseDateTime(value: String): LocalDateTime
Link copied to clipboard
Link copied to clipboard
fun today(instant: Instant = now(), timeZone: TimeZone = TimeZone.currentSystemDefault()): LocalDate
Link copied to clipboard
fun yearsBetween(start: LocalDate, end: LocalDate): Long