Skip to content

Commit

Permalink
add info block, fix list of relative-date methods
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmayer committed Mar 4, 2023
1 parent 29596ab commit b95f499
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ const secondRandom = faker.number.int();
console.log(firstRandom === secondRandom);
```

Note that when upgrading to a new version of Faker, you may get different values for the same seed, as the underlying data (lists of names, words etc) may have changed.
::: info NOTE
When upgrading to a new version of Faker, you may get different values for the same seed, as the underlying data (lists of names, words etc) may have changed.
:::

There are a few relative date methods for which setting a random seed is not sufficient to have reproducible results, specifically: `faker.date.soon`, `faker.date.birthdate`, `faker.date.soon` and `faker.date.recent`. This is because these methods default to creating a date before or after "today", and "today" depends on when the code is run. To fix this, you can specify a fixed reference date as a Date or string, for example:
There are a few relative date methods for which setting a random seed is not sufficient to have reproducible results, specifically: `faker.date.past`, `faker.date.future`, `faker.date.birthdate`, `faker.date.recent` and `faker.date.soon`. This is because these methods default to creating a date before or after "today", and "today" depends on when the code is run. To fix this, you can specify a fixed reference date as a Date or string, for example:

```ts
// creates a date soon after 2023-01-01
Expand Down

0 comments on commit b95f499

Please sign in to comment.