-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
c: featureRequest for new featureRequest for new features: pending triagePending TriagePending Triages: waiting for user interestWaiting for more users interested in this featureWaiting for more users interested in this feature
Description
Clear and concise description of the problem
currently past and future supports only option to set max range in years
In case test needs short date in past/future (.toISOString().slice(0, 10) magic 🪄) you can still get date of current day
Suggested solution
to avoid adjusting reference date or manually adding +/- days it would be nice to support additional config to set min diff
e.g.
faker.date.past({yearsMin: 1, years: 2}) // at least 1 year but not more than 2 years in the past
faker.date.future({yearsMin: 1, years: 2}) // at least 1 year but not more than 2 years in the future
I guess same would apply for soon and recent
Alternative
I can use date-fns to add/remove random number of days but it feels bit to ugly
addDays(
new Date(),
faker.number.int({ min: 1, max: 20 }),
)
.toISOString()
.slice(0, 10)Additional context
No response
github-actions
Metadata
Metadata
Assignees
Labels
c: featureRequest for new featureRequest for new features: pending triagePending TriagePending Triages: waiting for user interestWaiting for more users interested in this featureWaiting for more users interested in this feature