Table of Contents

Class TimeStepHelpers

Namespace
TwBlazor.Utilities
Assembly
TwBlazor.dll

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

step int

The step in minutes.

Returns

bool

true when the step lines up with the clock; otherwise false.

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

time TimeOnly

The current time.

step int

The step in minutes.

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

time TimeOnly

The current time.

step int

The step in minutes.

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

step int

The step in minutes.

Exceptions

ArgumentOutOfRangeException

Thrown when the step does not line up with the clock.