Skip to main content
Version: 6.2 🚧

Kotlinx DateTime Gens

Kotest provides an optional module that provides generators for KotlinX DateTime.

note

To use, add io.kotest.extensions:kotest-property-datetime:version to your build.

GeneratorDescriptionJVMJSNative
Arb.date(yearRange)Generates LocalDates with the year between the given range and other fields randomly.βœ“βœ“βœ“
Arb.datesBetween(startDate, endDate, zoneId)Generates LocalDates in the given range. If zoneId is provided, days of daylight saving time changes are included in edge casesβœ“βœ“βœ“
Arb.datetime(yearRange, hourRange, minuteRange, secondRange)Generates LocalDateTimes with all fields in the given rangesβœ“βœ“βœ“
Arb.instant(range)Generates Instants with the epoch randomly generated in the given rangeβœ“βœ“βœ“