diff options
| author | ST-DDT <[email protected]> | 2024-10-20 17:53:50 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-20 15:53:50 +0000 |
| commit | 3f3d628cfa16198b0e6c4301eb802bb787a46367 (patch) | |
| tree | 023e96f5bbd07f3827301407542d279eb6f800e2 /src/modules | |
| parent | abd4d247707a123272a3b337d7183230eec860b7 (diff) | |
| download | faker-3f3d628cfa16198b0e6c4301eb802bb787a46367.tar.xz faker-3f3d628cfa16198b0e6c4301eb802bb787a46367.zip | |
docs(date): add hints how to generate date ranges (#3128)
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/date/index.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/modules/date/index.ts b/src/modules/date/index.ts index 06890a5d..e2565cf4 100644 --- a/src/modules/date/index.ts +++ b/src/modules/date/index.ts @@ -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 |
