diff options
| author | ST-DDT <[email protected]> | 2023-01-24 22:51:25 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-01-24 22:51:25 +0100 |
| commit | 3a44d5fa48e8b28a7b9422a18262e39af1d1cb91 (patch) | |
| tree | 9aad6f26baf083215fe805eb898beab1e791679c /src/modules/git | |
| parent | 28a9848a8efed508a677afa868cc0c31db777979 (diff) | |
| download | faker-3a44d5fa48e8b28a7b9422a18262e39af1d1cb91.tar.xz faker-3a44d5fa48e8b28a7b9422a18262e39af1d1cb91.zip | |
feat(date): introduce faker.defaultRefDate and setDefaultRefDate (#1757)
Co-authored-by: Shinigami <[email protected]>
Diffstat (limited to 'src/modules/git')
| -rw-r--r-- | src/modules/git/index.ts | 6 |
1 files changed, 3 insertions, 3 deletions
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 }) |
