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

Feature request: Date in range #69

Open
Billy- opened this issue Jun 12, 2017 · 4 comments
Open

Feature request: Date in range #69

Billy- opened this issue Jun 12, 2017 · 4 comments

Comments

@Billy-
Copy link

Billy- commented Jun 12, 2017

I would like to be able to generate a casual.unix_time that is between a certain range of dates.

Many thanks for a great module.

@mattgabor
Copy link

Does anyone have a workaround solution for this?

@Billy-
Copy link
Author

Billy- commented Sep 12, 2017

Not sure why I didn't think of this before, but just had a look at the source code, and it just uses casual.integer:

return this.integer(0, 1462369607);

so you can use that with your desired range

@mattgabor
Copy link

mattgabor commented Sep 14, 2017

I see, thanks for finding that! I was actually referring to casual.date but I see that just calls moment so I can call it directly. Still would be nice to have a convenience method for readability.

@jasonlimantoro
Copy link

jasonlimantoro commented Jun 30, 2019

Are there any updates?
I need to generate random dates at a given range.

A very common use case would be to generate random createdAt and endedAt dates which adhere to the following condition: createdAt < endedAt.

It would be nice to have an API for date generator with custom range since I believe this is a very common use case.

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

No branches or pull requests

3 participants