-
-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(date): introduce faker.defaultRefDate and setDefaultRefDate #1757
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #1757 +/- ##
=======================================
Coverage 99.64% 99.64%
=======================================
Files 2340 2340
Lines 242624 242653 +29
Branches 1103 1110 +7
=======================================
+ Hits 241772 241801 +29
Misses 831 831
Partials 21 21
|
I think But I would like to have (for now) a IMO for now it should be next to |
…er-js#1757) Co-authored-by: Shinigami <[email protected]>
Fixes #859
This PR introduces the
faker.setDefaultRefDate
method, that can be used to configure the defaultrefDate
fallback value.I'm not very happy with both the name and implementation.refDateFallbackSource
.date
module, but then I would need to pass the fallback to thetoDate
function that is located outside.DateModule
would complicateFaker.fork
andFaker.derive
.toDate
to the module directly causes some issues as well (IIRC)fakerCore.config{dateRefDateFallbackSource, helpersUniqueFallbackStore, ...}
or something similar. That way, it can share or not share these things between faker instances, configure it globally or per method (it's bound fakerCore)Defaults to `refDateSource()`.
in an easier to understand way.Any feedback or suggestions are welcome!