From 26db8f8bbcdb1e6484bccc384250a1bdeb731042 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 22 Sep 2024 10:52:06 +0200 Subject: [PATCH 1/2] docs(date): add hints how to generate date ranges --- 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 f2eac1cf80e..250a77a4e47 100644 --- a/src/modules/date/index.ts +++ b/src/modules/date/index.ts @@ -567,6 +567,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, end] = faker.date.betweens({ from, to, count: 2 });` + * - `const start = faker.date.soon(); const end = faker.date.soon({ refDate: start });` + * * 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 From c78ceb0cdde9186a130e72043e747ea2ee2d39a8 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 11 Oct 2024 00:09:15 +0200 Subject: [PATCH 2/2] chore: apply change request --- src/modules/date/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/date/index.ts b/src/modules/date/index.ts index 250a77a4e47..324e28bd09c 100644 --- a/src/modules/date/index.ts +++ b/src/modules/date/index.ts @@ -569,8 +569,8 @@ export class SimpleDateModule extends SimpleModuleBase { * * If you need to generate a date range (start-end), you can do so using either of these two methods: * - * - `const [start, end] = faker.date.betweens({ from, to, count: 2 });` * - `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: