Skip to content

//core/io.github.serpro69.kfaker.provider/Person/birthDate

birthDate

[jvm]\

@JvmOverloads

fun birthDate(age: Long, at: LocalDate = LocalDate.now()): LocalDate

Returns a pseudo-random birthDate as LocalDate for the given age value.

If the at date parameter is not provided, then LocalDate.now is used to calculate the "lower bound" for the resulting birthDate. Assuming the age value of 30, the resulting date will be in the range of:

val start = LocalDate.now().minusYears(30)
val end = LocalDate.now().minusYears(29).minusDays(1)

Return

a pseudo-randomly calculated birthDate as instance of LocalDate

Parameters

jvm

age the person's age for which the birthDate will be calculated
at a date at which the person was of the specified age. Equals to the result of LocalDate.now by default