-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
Allow locally set time references for Date and Faker[T] #500
Conversation
60370f3
to
87b194f
Compare
I like the setting as with the seed. This makes logically a lot of sense and is cleaner then having a property to set. |
@garcipat I think I agree. Perhaps we can |
@bchavez No what I meant I like the UseDateTimeReference method over setting it as a property as I did it in the PR #492. I think you should keep the UseSeed separated. Both make something completly different and it's more a fluent synthax like that. |
@bchavez If you like I write a test for every method. I dont know if you need to have all of them covered with the relative or if one with DateOnly and one with TimeOnly already covers enough. I can do it in the other PR and you can take it over and tweak it. To spare you some time. |
610cb64
to
4a22cdd
Compare
API surface so far: //configuring per Faker[T] instance
var fakerT = new Faker<T>()
.UseSeed(1337)
.UseDateTimeReference(new DateTime(2022, 1, 23))
//configuring per Faker instance
var faker = new Faker()
{
Random = new Randomizer(1337),
DateTimeReference = new DateTime(2022, 1, 23)
}
//configuring per Date dataset instance
var dateDataSet = new Date()
{
Random = new Randomizer(1337),
LocalSystemClock = () => new DateTime(2022, 1, 23)
} I'm thinking so far, seems
is more semantically accurate. The only good thing about |
4d1bfa9
to
6bfec5c
Compare
My recent changes on my branch are not in the PR #492 anymore since you closed it, but on the same branch. Just becasue I think now you did not pull over the recent changes where I took over most of your changes in this branch and its mixed up now :( |
27434d7
to
246fb8d
Compare
@bchavez the PR does not contain my recent changes since it was closed before that. I'm talking about the changes I did yesterday as promised. For all the operations that reference the GetTimeReference() you wrote I added a test for regular and Offset methods to cover all the cases (mainly here) and also the corrections in the comments that reference DateTime.Now. |
Ah I see you wrote the tests yourself now. Well I dont know anymore then. I think I will leave it to you since it seems I'm only doing everything in parallel while trying to help adding the missing things. |
@garcipat hmm. closing the PR should not have any impact on what was committed; or what previously & currently exists on your fork: The only way something could be "lost" is if you pushed some code locally to your fork that wasn't totally in-sync with what you pushed to your fork/remote. That said tho, I think we should continue to focus energy on PR #500 since this is the PR we will go with; I'm just putting the final touches on the public API surface:
Right now, kinda leaning to renaming |
Can I push to that branch? With "focus energy in that branch" would require me to be able to do that. Otherwise I cannot help. I can push the same changes there to if its technically possible. I will try I guess. Regarding the proposals, I would lean to the firstor the third. The seconds feels very technical and not so semantically and The "Local" in the last could be confusing about the Local/Utc DateTimeKind because of the wording. One thing that would give UseDateTimeReference a +1 is, that all arguments in the Api are called refDate. Therefore this would be aligned with that. Edit: Yes just tried. I can't commit to this branch either. You have to take the changes over manually from my branch if you want them. |
a0a12cd
to
ffa36ce
Compare
0b65acc
to
cc799df
Compare
@bchavez what should be done to get this feature merged? It still would be great if we had this! |
@304NotModified i think the first thing is to get this rebased to master. then finally, one final review push/reading through the context on this ticket to make sure I'm not missing anything. and also some README documentation changes. Currently, getting taxes done is my main blocker on any open-source work/releases atm. I'll try to get this branch rebased this weekend. |
246fb8d
to
ac42247
Compare
ac42247
to
3ddb371
Compare
c60535b
to
5eb7adf
Compare
d60c2cc
to
9a1be0d
Compare
…ker.
d9f349a
to
18f8a52
Compare
@304NotModified and @garcipat, i think this PR is just about ready. I'm planning on merging it next weekend. @garcipat, I pulled in your tests from PR #508 and gave you credit on the Let me know if there's any major concerns with the PR before we merge next weekend. |
Excellent news! |
Thank you so much. I feel honored and am very happy that I could contribute something! |
Changes are released in Bogus Let me know if there are any issues. 👍 |
Allows locally set time references for Date calculations instead of global statics. See Faker[T].UseDateTimeReference() and Date.LocalSystemClock. Alternative PR to #492.