Faker v0.10.0 Faker.Date View Source

Functions for generating dates

Link to this section Summary

Functions

Returns a random date in the past up to N days, today not included

Returns a random date between two dates

Returns a random date of birth for a person with an age specified by a number or range

Returns a random date in the future up to N days, today not included

Link to this section Functions

Link to this function backward(days) View Source
backward(integer()) :: Date.t()

Returns a random date in the past up to N days, today not included

Link to this function between(from, to) View Source
between(Date.t(), Date.t()) :: Date.t()

Returns a random date between two dates

Link to this function date_of_birth(age_or_range \\ 18..99) View Source
date_of_birth(integer()) :: Date.t()
date_of_birth(Range.t()) :: Date.t()

Returns a random date of birth for a person with an age specified by a number or range

Examples

date_of_birth #=> ~D[1961-05-09]
date_of_birth(1) #=> ~D[2015-12-06]
date_of_birth(10..19) #=> ~D[2004-05-15]

Returns a random date in the future up to N days, today not included