casual
casual copied to clipboard
Feature request: Date in range
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.
Does anyone have a workaround solution for this?
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: https://github.com/boo1ean/casual/blob/4f05a130c0f10bf7a3f0b7555985fec6d7d070d3/src/providers/date.js#L9
so you can use that with your desired range
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.
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.