Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Add DateTime ranged relay #1162

wants to merge 9 commits into from

Conversation

Tarig0
Copy link

@Tarig0 Tarig0 commented Jan 28, 2020

Allows The ability to Parse Range Attributes for the type DateTime and create a valid DateTime within the specified range

Copy link
Member

@zvirja zvirja left a 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
Copy link
Member

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.

Copy link
Author

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?

@Kralizek
Copy link
Contributor

Kralizek commented Mar 6, 2020

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)

@Tarig0
Copy link
Author

Tarig0 commented Mar 12, 2020

Can you show me how the range attribute can be setup to parse the datetime explicitly?

@Tarig0
Copy link
Author

Tarig0 commented Mar 25, 2020

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParseDateTimeRange, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants