-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
Update the Date data set to avoid DST transition windows #366
base: master
Are you sure you want to change the base?
Commits on Apr 21, 2023
-
Added unit test DateTest.will_not_generate_values_that_do_not_exist_d…
…ue_to_daylight_savings that detects the error when run in a time zone with DST transitions. Updated DataSets/Date.cs to funnel all DateTime generation into Between and BetweenOffset, and updated the implementations of Between and BetweenOffset to convert the range to UTC before calculating the random value, and then convert the resulting UTC value back to local time, taking advantage of the framework's automatic DST calculations.
Configuration menu - View commit details
-
Copy full SHA for 18e0cfb - Browse repository at this point
Copy the full SHA 18e0cfbView commit details -
Added tests will_adjust_start_time_to_avoid_dst_transition and will_a…
…djust_end_time_to_avoid_dst_transition to DateTest.cs. Added method ComputeRealRange to DataSets/Date.cs, along with helper methods GetForwardDSTTransitionWindow and FindEffectiveTimeZoneAdjustmentRule, to find the windows of time values that don't correspond to real times due to DST transition and adjust the start & end times of the requested time interval to avoid them. Rewrote BetweenOffset in DataSets/Date.cs to leverage Between and tack the offset on afterward, so that the avoidance logic need only be in one place.
Configuration menu - View commit details
-
Copy full SHA for b598ea0 - Browse repository at this point
Copy the full SHA b598ea0View commit details -
Added unit tests to DateTest.cs exercising the edge cases where the s…
…tart/end times are exactly equal to the daylight savings time transition window start/end Updated ComputeRealRange to detect when start and end are in the same window, and to handle the edge case where start is exactly the last valid date/time before the window.
Configuration menu - View commit details
-
Copy full SHA for 718a240 - Browse repository at this point
Copy the full SHA 718a240View commit details -
Added test DateTest.works_when_start_time_is_invalid_due_to_DST_chang…
…e_window based on feedback from @bchavez. Updated the CalculateTransitionDateTime helper to specifically mark the DateTimes it returns as being DateTimeKind.Local. Reworked Date.Between and Date.BetweenOffset to encapsulate the semantics described by the tests: - If the range is contained entirely within the forward DST change window (i.e., an empty range), then it will always return the a boundary time. It prefers the end time unless it isn't a real time, in which case it prefers the start time. Updated ComputeRealRange to return out parameter preferRangeBoundary. - Updated ComputeRealRange to let the caller indicate whether the DateTime is local or not. - Updated BetweenOffset to call ComputeRealRange itself, since the DateTime values going into ComputeRealRange via Between will always be DateTimeKind.Unspecified.
Configuration menu - View commit details
-
Copy full SHA for 41cf3ed - Browse repository at this point
Copy the full SHA 41cf3edView commit details -
Configuration menu - View commit details
-
Copy full SHA for bf1ef28 - Browse repository at this point
Copy the full SHA bf1ef28View commit details -
Updated Recent and RecentOffset to avoid multiple consecutive calls t…
…o SystemClock, because in extremely rare cases, these could return different values, potentially not even in-order.
Configuration menu - View commit details
-
Copy full SHA for 93edfa9 - Browse repository at this point
Copy the full SHA 93edfa9View commit details -
Made reference to a variable name in a test failure message dynamical…
…ly linked to the actual variable using nameof().
Configuration menu - View commit details
-
Copy full SHA for de19a3b - Browse repository at this point
Copy the full SHA de19a3bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5c6013e - Browse repository at this point
Copy the full SHA 5c6013eView commit details