From 3485e7eece540b63059e97bd8166d1ffd88334de Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 24 Mar 2024 13:51:49 +0100 Subject: refactor(date)!: fail on invalid dates (#2757) --- docs/guide/upgrading_v9/2757.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 docs/guide/upgrading_v9/2757.md (limited to 'docs/guide') diff --git a/docs/guide/upgrading_v9/2757.md b/docs/guide/upgrading_v9/2757.md new file mode 100644 index 00000000..c7a79577 --- /dev/null +++ b/docs/guide/upgrading_v9/2757.md @@ -0,0 +1,9 @@ +### Fail on invalid dates + +Various methods in the `faker.date` module allow you to pass a `Date`-ish value: +that is, either a Javascript Date, or a timestamp number or string that can be converted to a `Date` via the `new Date()` constructor. + +Previously, if you passed something which could not be parsed to a `Date`, it would fall back to the current reference date. +Now, this throws an error raising awareness of that bad value. + +This affects the `refDate` parameter of the `anytime()`, `birthdate()`, `past()`, `future()`, `recent()` and `soon()`, methods as well as the `from` and `to` parameters of `between()` and `betweens()`. -- cgit v1.2.3