DateTimeHelper

Helper class for date and time related operations, particularly for determining if two Instants fall on the same day based on a specified day cutoff hour.

Functions

Link copied to clipboard
fun Instant.elapsedDays(other: Instant = Clock.System.now()): Double

Calculates the elapsed days between two Instants.

Link copied to clipboard
fun Instant.isSameDay(other: Instant, dayCutoffHour: Int = 4, timeZone: TimeZone = TimeZone.currentSystemDefault()): Boolean

Determines if two Instants fall on the same day, considering a specified day cutoff hour.

Link copied to clipboard
fun Instant.toDayNumber(dayCutoffHour: Int = 4, timeZone: TimeZone = TimeZone.currentSystemDefault()): Long

Converts an Instant to a day number, considering a specified day cutoff hour.