Class TimeStepHelpers
Shared time stepping calculations used by the time picker components (e.g. TwTimePicker).
public static class TimeStepHelpers
- Inheritance
-
TimeStepHelpers
- Inherited Members
Methods
IsValidStep(int)
Determines whether step is a supported step in minutes: a divisor of an hour
(1, 2, 3, 4, 5, 6, 10, 12, 15, 20 or 30) or a whole number of hours that divides a day
(60, 120, 180, 240, 360, 480 or 720).
public static bool IsValidStep(int step)
Parameters
stepintThe step in minutes.
Returns
StepDown(TimeOnly, int)
Moves time back to the previous multiple of step minutes after
midnight, wrapping past midnight. A time already on the step moves a whole step; a time between
steps moves to the one before it.
public static TimeOnly StepDown(TimeOnly time, int step)
Parameters
Returns
- TimeOnly
The stepped time, keeping the seconds of
time.
StepUp(TimeOnly, int)
Moves time forward to the next multiple of step minutes after
midnight, wrapping past midnight. A time already on the step moves a whole step; a time between
steps moves to the next one, as a native <input type="time"> does.
public static TimeOnly StepUp(TimeOnly time, int step)
Parameters
Returns
- TimeOnly
The stepped time, keeping the seconds of
time.
ValidateStep(int)
Throws when step is not supported by IsValidStep(int).
public static void ValidateStep(int step)
Parameters
stepintThe step in minutes.
Exceptions
- ArgumentOutOfRangeException
Thrown when the step does not line up with the clock.