From 3a44d5fa48e8b28a7b9422a18262e39af1d1cb91 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 24 Jan 2023 22:51:25 +0100 Subject: feat(date): introduce faker.defaultRefDate and setDefaultRefDate (#1757) Co-authored-by: Shinigami --- src/modules/git/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/modules/git') diff --git a/src/modules/git/index.ts b/src/modules/git/index.ts index 76e786ab..05d24f71 100644 --- a/src/modules/git/index.ts +++ b/src/modules/git/index.ts @@ -143,7 +143,7 @@ export class GitModule { * Generates a date string for a git commit using the same format as `git log`. * * @param options The optional options object. - * @param options.refDate The date to use as reference point for the commit. Defaults to `new Date()`. + * @param options.refDate The date to use as reference point for the commit. Defaults to `faker.defaultRefDate()`. * * @example * faker.git.commitDate() // 'Mon Nov 7 14:40:58 2022 +0600' @@ -156,12 +156,12 @@ export class GitModule { /** * The date to use as reference point for the commit. * - * @default new Date() + * @default faker.defaultRefDate() */ refDate?: string | Date | number; } = {} ): string { - const { refDate = new Date() } = options; + const { refDate = this.faker.defaultRefDate() } = options; const dateParts = GIT_DATE_FORMAT_BASE.format( this.faker.date.recent({ days: 1, refDate }) -- cgit v1.2.3