Skip to content

Commit

Permalink
Update the documentation examples
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrAdelKhalil committed Sep 19, 2019
1 parent ed55424 commit b3ba644
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions doc/default/date.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ Faker::Date.backward(days: 14) #=> "Fri, 19 Sep 2014"
Faker::Date.birthday(min_age: 18, max_age: 65) #=> "Mar, 28 Mar 1986"

# Random date in current year
Faker::Internet.in_date_period #=> #<Date: 2019-09-01>
Faker::Date.in_date_period #=> Tue, 28 May 2019

# Random date for range of year 2018 and month 2
# Keyword arguments: year, month
Faker::Date.in_date_period(year: 2018, month: 2) #=> #<Date: 2018-02-26>
Faker::Date.in_date_period(year: 2018, month: 2) #=> Sun, 04 Feb 2018

# Random date for range of current year and month 2
# Keyword arguments: month
Faker::Date.in_date_period(month: 2) #=> #<Date: 2019-02-26>
Faker::Date.in_date_period(month: 2) #=> Wed, 06 Feb 2019

```
10 changes: 3 additions & 7 deletions lib/faker/default/date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,17 @@ def birthday(legacy_min_age = NOT_GIVEN, legacy_max_age = NOT_GIVEN, min_age: 18
# Produces a date in the year and/or month specified.
#
# @param month [Integer] represents the month of the date
#
# @param year [Integer] represents the year of the date
#
#
# @return [Date]
#
# @example
# Faker::Internet.in_date_period #=> #<Date: 2019-09-01>
# Faker::Date.in_date_period #=> Tue, 28 May 2019
#
# @example
# Faker::Date.in_date_period(year: 2018, month: 2) #=> #<Date: 2018-02-26>
# Faker::Date.in_date_period(year: 2018, month: 2) #=> Sun, 04 Feb 2018
#
# @example
# Faker::Date.in_date_period(month: 2) #=> #<Date: 2019-02-26>
#
# Faker::Date.in_date_period(month: 2) #=> Wed, 06 Feb 2019
#
# @faker.version next
def in_date_period(month: nil, year: ::Date.today.year)
Expand Down

0 comments on commit b3ba644

Please sign in to comment.