Skip to content

Commit

Permalink
docs(date): add hints how to generate date ranges (#3128)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Oct 20, 2024
1 parent abd4d24 commit 3f3d628
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modules/date/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,11 @@ export class SimpleDateModule extends SimpleModuleBase {
*
* For more control, any of these methods can be customized with further options, or use [`between()`](https://fakerjs.dev/api/date.html#between) to generate a single date between two dates, or [`betweens()`](https://fakerjs.dev/api/date.html#betweens) for multiple dates.
*
* If you need to generate a date range (start-end), you can do so using either of these two methods:
*
* - `const start = faker.date.soon(); const end = faker.date.soon({ refDate: start });`
* - `const [start, end] = faker.date.betweens({ from, to, count: 2 });` // does not work with tsconfig's `noUncheckedIndexedAccess: true`
*
* Dates can be specified as Javascript Date objects, strings or UNIX timestamps.
* For example to generate a date between 1st January 2000 and now, use:
* ```ts
Expand Down

0 comments on commit 3f3d628

Please sign in to comment.