Closed rgarrison12345 closed 2 years ago
Sounds good - I think we can do this. However, some points:
DateOnly
and TimeOnly
method generations need to use #if NET6
preprocessor directives.The bad part about this is that the Bogus.nupkg
is going to grow in size by another factor because we are shipping a new net6
specific TFM/DLL.
Hi @bchavez ,
I am new to this repository but following it from long time. If @rgarrison12345 did not started working on this open issue, I would like to contribute to this repository.
@rgarrison12345 can I go ahead and try this out?
Hey @prasadtelkikar, cool! That's fine with me. I'm sure we can all collaborate on it.
However, for whoever works on the PR initially, please just a few tips to keep in mind would be great:
Thanks so much @prasadtelkikar and @rgarrison12345. All these tips should help the review/merge process go smoothly.
Hello @prasadtelkikar you can take on the PR if you would like.
Hi @bchavez,
I just shared a design document for this feature implementation. I would like to know your thoughts on it. @rgarrison12345 I did not find your email address. I can forward you the same email if you would like to go through it.
@prasadtelkikar , you can post the design doc in the Discussions tab: https://github.com/bchavez/Bogus/discussions
I would say, Approach 1: Add new functions to Date
dataset instead of using inheritance.
For an initial start, here's the methods I would start with:
PastDateOnly
- Make defaults consistent with Past() DateTimeSoonDateOnly
- Make defaults consistent with Soon() DateTimeSoonTimeOnly
- Some time in the next 15 minutesFutureDateOnly
- Make defaults consistent with Future() DateTimeBetweenDateOnly
- Make defaults consistent with Between() DateTimeBetweenTimeOnly
- Some TimeOnly Between Start and End; always in a clockwise directionRecentDateOnly
- Make defaults consistent with Recent() DateTimeRecentTimeOnly
- Some time in the last 15 minutesWhen implementing Approach 1, try to keep all of these new methods grouped into one code section (at the end of Date.cs
) so that #if NET6 / #endif
directive is only used once.
I'm also running in to this and am blocked from some refactoring I was hoping to start tackling. Details here if it helps: https://github.com/nickdodd79/AutoBogus/issues/76
@bchavez those options would work well for my use cases
Also, looks like AppVeyor has .NET 6 support so shouldn't be any blockers there anymore based on your note :-)
Hi @pdevito3, thanks a bunch for checking in and linking to the AppVeyor news. That's great.
After reading the news, looks like we're going to need a tooling update to get access to .NET 6.
https://github.com/bchavez/Bogus/blob/1406a8ba7ae326dca106bbf5bb827fcd7e47be82/appveyor.yml#L2
So, it looks like there is still some blocking work we need to do before merging a Date/TimeOnly
PR.
Basically, we need to update our 1) AppVeyor image and 2) my tooling on my local dev box, and 3) our tests working on the .NET 6 SDK before we can merge a Date/TimeOnly
PR.
This is done now. Thanks for the help @prasadtelkikar!
It's very late right now... but I'll make a new release within the next few days.
thanks guys! 🎉
Hey all, Bogus v34.0.1
released with .NET 6 support for DateOnly
and TimeOnly
.
Please describe why you are requesting a feature
With .NET 6 comes the new DateOnly and TimeOnly types. Would like to see a random value for both of these types just like random generators for date time and datetimeoffset.
Please provide a code example of what you are trying to achieve
(Please be complete. Include all code necessary to run your example in LINQPad.) (The more complete code examples are, the more accurate answers will be.) (https://www.linqpad.net)
Please answer any or all of the questions below
Is the feature something that currently cannot be done? No
What alternatives have you considered? N/A
Is this feature request any issues or current problems? No
Has the feature been requested in the past? No
If the feature request is approved, would you be willing to submit a PR?
Yes / No (Help can be provided if you need assistance submitting a PR) Yes