diff --git a/doc/default/date.md b/doc/default/date.md index 980e40aa54..858fb2193e 100644 --- a/doc/default/date.md +++ b/doc/default/date.md @@ -3,11 +3,15 @@ ```ruby # Random date between dates # Keyword arguments: from, to -Faker::Date.between(from: 2.days.ago, to: Date.today) #=> "Wed, 24 Sep 2014" +Faker::Date.between(from: '2014-09-23', to: '2014-09-25') #=> # +# If used with Rails (the Active Support gem), additional options are available: +Faker::Date.between(from: 2.days.ago, to: Date.today) #=> # # Random date between dates except for certain date # Keyword arguments: from, to, excepted -Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) #=> "Wed, 24 Sep 2014" +Faker::Date.between_except(from: '2014-09-23', to: '2015-09-25', excepted: '2015-01-24') #=> # +# If used with Rails (the Active Support gem), additional options are available: +Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) #=> # # Random date in the future (up to maximum of N days) # Keyword arguments: days diff --git a/lib/faker/default/date.rb b/lib/faker/default/date.rb index 966ce22d13..2b9d88a113 100644 --- a/lib/faker/default/date.rb +++ b/lib/faker/default/date.rb @@ -10,9 +10,11 @@ class << self # @param to [Date, String] The end of the usable date range. # @return [Date] # - # @example - # Faker::Date.between(from: 2.days.ago, to: Date.today) - # #=> # + # @example if used with or without Rails (Active Support) + # Faker::Date.between(from: '2014-09-23', to: '2014-09-25') #=> # + # + # @example if used with Rails (Active Support) + # Faker::Date.between(from: 2.days.ago, to: Date.today) #=> # # # @faker.version 1.0.0 def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from:, to:) @@ -37,9 +39,11 @@ def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from:, to:) # @param excepted [Date, String] A date to exclude. # @return [Date] # - # @example - # Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) - # #=> # + # @example if used with or without Rails (Active Support) + # Faker::Date.between_except(from: '2014-09-23', to: '2015-09-25', excepted: '2015-01-24') #=> # + # + # @example if used with Rails (Active Support) + # Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) #=> # # # @faker.version 1.6.2 def between_except(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_excepted = NOT_GIVEN, from:, to:, excepted:)