-
Notifications
You must be signed in to change notification settings - Fork 337
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
Add DateTime ranged relay #1162
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me, perfect 🤝
Could you please also clarify the scenario how you use it? Is that for Range
annotation attribute? If that's the case, could we also add general integration test like this?
return new DateTime((long)ticksInRange); | ||
} | ||
|
||
private struct DateTimeRange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We could also make it a readonly struct
, as it's not supposed to be mutated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the TimeSpanRange also need to be updated?
Not a maintainer. Would it be possible to add a way to control which culture is used in the parsing process? It could be helpful to be explicit in a multi-culture environment where developers have their machine with one locale (e.g. it-it) and the build server uses something else (e.g. en-us). In this case parsing 1/12/1997 might work on a dev machine (where it's read as December 1st) but not on the build server (read as January 12th) |
Can you show me how the range attribute can be setup to parse the datetime explicitly? |
Looks like there is no way to override the parse for the range attribute at this time so the current implementation will cover all uses |
return RandomizeDateTimeInRange(range, context); | ||
} | ||
|
||
private static DateTimeRange ParseTimeSpanRange(RangedRequest rangedRequest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ParseDateTimeRange, right?
Allows The ability to Parse Range Attributes for the type DateTime and create a valid DateTime within the specified range