From 3f3d628cfa16198b0e6c4301eb802bb787a46367 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 20 Oct 2024 17:53:50 +0200 Subject: [PATCH] docs(date): add hints how to generate date ranges (#3128) --- src/modules/date/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/date/index.ts b/src/modules/date/index.ts index 06890a5d462..e2565cf4518 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