Faker v0.8.0 Faker.Date

Functions for generating dates

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

Functions

backward(days)
backward(integer) :: Date.t

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

between(from, to)
between(Date.t, Date.t) :: Date.t

Returns a random date between two dates

date_of_birth(age_or_range \\ 18..99)
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]
forward(days)
forward(integer) :: Date.t

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