Package-level declarations

Types

Link copied to clipboard
data class TimeDelta(val days: Int, val hours: Int, val minutes: Int, val seconds: Int, val totalSeconds: Long)

Represents the components of a time delta.

Functions

Link copied to clipboard
fun LocalDate.dayOfWeekAbbr(): String

Returns the abbreviated day-of-week name for this date. Example: LocalDate(2024, 3, 5).dayOfWeekAbbr() → "Tue"

Link copied to clipboard
fun LocalDate.dayOfWeekName(): String

Returns the day-of-week name for this date. Example: LocalDate(2024, 3, 5).dayOfWeekName() → "Tuesday"

Link copied to clipboard
fun LocalDate.daysInMonth(): Int

Returns the number of days in the month of this date. Example: LocalDate(2024, 2, 1).daysInMonth() → 29 (2024 is a leap year)

Link copied to clipboard

Formats the delta between two epoch-second timestamps as a verbose string. Example: startEpoch.deltaStringTo(endEpoch) → "1 year, 3 months"

Link copied to clipboard
fun Instant.deltaTo(other: Instant = Clock.System.now()): TimeDelta

Computes the TimeDelta between two Instants. other defaults to now. Example: startInstant.deltaTo() → TimeDelta(days=65, hours=5, ...)

Link copied to clipboard
fun TimeZone.displayName(instant: Instant = Clock.System.now()): String

Returns the display name of a TimeZone with its current UTC offset. Example: TimeZone.of("Europe/Paris").displayName() → "Europe/Paris (UTC+01:00)"

Link copied to clipboard
fun LocalDate.fiscalQuarter(fiscalYearStartMonth: Int = 1): Int

Returns the fiscal quarter (1–4) for a LocalDate given a fiscal year start month. fiscalYearStartMonth defaults to 1 (January = calendar year). Example: LocalDate(2024, 10, 15).fiscalQuarter(fiscalYearStartMonth = 10) → 1

Link copied to clipboard
fun LocalDate.fiscalQuarterEnd(fiscalYearStartMonth: Int = 1): LocalDate

Returns the last day of the fiscal quarter this date belongs to.

Link copied to clipboard
fun LocalDate.fiscalQuarterStart(fiscalYearStartMonth: Int = 1): LocalDate

Returns the first day of the fiscal quarter this date belongs to. Example: LocalDate(2024, 11, 20).fiscalQuarterStart(fiscalYearStartMonth = 10) → LocalDate(2024, 10, 1)

Link copied to clipboard
fun LocalDate.fiscalYear(fiscalYearStartMonth: Int = 1): Int

Returns the fiscal year for a LocalDate given a fiscal year start month. Example: LocalDate(2024, 10, 15).fiscalYear(fiscalYearStartMonth = 10) → 2025

Link copied to clipboard
fun Instant.formatInZone(tz: TimeZone): String

Converts an Instant to a formatted datetime string in the given TimeZone. Example: someInstant.formatInZone(TimeZone.of("Europe/Paris")) → "2024-03-05 14:30:00 UTC+01:00"

Link copied to clipboard
fun LocalDate.isLeapYear(): Boolean

Returns true if the year of this date is a leap year.

Link copied to clipboard
fun LocalDate.isWeekday(): Boolean

Returns true if this date falls on a weekday.

Link copied to clipboard
fun LocalDate.isWeekend(): Boolean

Returns true if this date falls on a weekend (Saturday or Sunday).

Link copied to clipboard

Formats a UTC offset in total minutes as "UTC±HH:MM". Example: 330.minutesToUtcOffset() → "UTC+05:30" Example: (-300).minutesToUtcOffset() → "UTC-05:00"

Link copied to clipboard
fun LocalDate.monthName(): String

Returns the full month name for this date. Example: LocalDate(2024, 3, 5).monthName() → "March"

Link copied to clipboard
fun LocalDate.quarter(): Int

Returns the quarter (1–4) this date belongs to. Example: LocalDate(2024, 8, 15).quarter() → 3

Link copied to clipboard

Formats a UTC offset in total seconds as "UTC±HH:MM:SS" or "UTC±HH:MM" if seconds are zero. Example: 19800.secondsToUtcOffset() → "UTC+05:30"

Link copied to clipboard
fun TimeZone.shortLabel(instant: Instant = Clock.System.now()): String

Returns a short label for a TimeZone offset. Example: TimeZone.of("Asia/Kolkata").shortLabel() → "UTC+5:30"

Link copied to clipboard
fun LocalDate.toDayMonthYear(): String

Formats a LocalDate as "DD/MM/YYYY". Example: LocalDate(2024, 3, 5).toDayMonthYear() → "05/03/2024"

Link copied to clipboard
fun LocalDate.toFiscalQuarterLabel(fiscalYearStartMonth: Int = 1): String

Returns a formatted fiscal quarter label like "Q1 FY2025". Example: LocalDate(2024, 10, 15).toFiscalQuarterLabel(fiscalYearStartMonth = 10) → "Q1 FY2025"

Link copied to clipboard
fun LocalDate.toIsoString(): String

Formats a LocalDate as "YYYY-MM-DD" (ISO 8601). Example: LocalDate(2024, 3, 5).toIsoString() → "2024-03-05"

Link copied to clipboard
fun LocalDate.toLongDate(): String

Formats a LocalDate as "Month D, YYYY". Example: LocalDate(2024, 3, 5).toLongDate() → "March 5, 2024"

Link copied to clipboard

Formats a TimeDelta as a verbose string showing all non-zero components. Example: delta.toLongString() → "65 days, 3 hours"

Link copied to clipboard
fun LocalDate.toMonthDayYear(): String

Formats a LocalDate as "MM/DD/YYYY" (US style). Example: LocalDate(2024, 3, 5).toMonthDayYear() → "03/05/2024"

Link copied to clipboard
fun Long.toRelativeTime(now: Instant = Clock.System.now()): String

Returns a human-readable relative time string from an epoch-second timestamp compared to now (defaults to the current instant).

fun Instant.toRelativeTime(now: Instant = Clock.System.now()): String

Returns a relative time string from an Instant compared to now. Example: someInstant.toRelativeTime() → "3 hours ago"

Link copied to clipboard
fun LocalDate.toShortDate(): String

Formats a LocalDate as "Mon DD, YYYY" (abbreviated month). Example: LocalDate(2024, 3, 5).toShortDate() → "Mar 05, 2024"

Link copied to clipboard
fun Instant.toShortRelativeTime(now: Instant = Clock.System.now()): String

Returns a concise relative time string (e.g. for feed timestamps). Uses abbreviated units: "s", "m", "h", "d", "w", "mo", "y". Example: someInstant.toShortRelativeTime() → "3h"

Link copied to clipboard

Formats a TimeDelta showing only the two most significant components. Example: delta.toShortString() → "2 months, 5 days"

Link copied to clipboard
fun TimeZone.utcOffsetAt(instant: Instant = Clock.System.now()): String

Returns the UTC offset string for a named TimeZone at a given Instant. Example: TimeZone.of("America/New_York").utcOffsetAt() → "UTC-05:00"

Link copied to clipboard
fun LocalDate.weekOfYear(): Int

Returns the ISO week number (1–53) for this date.