coerceDuration

Returns the selectable duration closest to duration. Equal distances prefer the smaller duration.

Parameters

duration

The finite, non-negative, whole-minute duration to coerce.

Throws

if duration is not finite, non-negative, and aligned to a whole minute, or if these item sources are invalid or contain no allowed combination.


fun coerceDuration(hours: Int, minutes: Int): Duration

Returns the selectable duration closest to the requested hours and minutes.

Parameters

hours

The requested non-negative elapsed whole-hour component.

minutes

The requested minute-within-hour component in 0..59.

Throws

if the requested parts or item sources are invalid.