Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method for generating a date in a given year to Faker::Date #1746

Closed
connorshea opened this issue Sep 15, 2019 · 2 comments · Fixed by #1755
Closed

Add a method for generating a date in a given year to Faker::Date #1746

connorshea opened this issue Sep 15, 2019 · 2 comments · Fixed by #1755

Comments

@connorshea
Copy link
Member

Is your feature request related to a problem? Please describe.
I have a scope in my Rails app that filters video games based on their release year. I'd like to use Faker to generate a random date in a given year for my tests.

Describe alternatives you've considered

I know I can pretty much get this functionality using between, but it's not very convenient.

# with `between`:
Faker::Date.between(from: 'January 1, 2018', to: 'December 31, 2018') #=> 2018-11-20
# ideally:
Faker::Date.in_year(2018) #=> 2018-11-20

I don't know if in_year is a good name for this, but it makes sense to me. Happy to hear any suggestions or if this suggestion seems reasonable :)

Faker::Date docs

@AmrAdelKhalil
Copy link
Contributor

@vbrazo Hi, Can I work on this one?

@Zeragamba
Copy link
Contributor

Feel free to open a PR when you have a fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants