Function snap_time

Source
pub fn snap_time(value: TimeValue, step_minutes: u8) -> TimeValue
Expand description

Rounds a time to the nearest sanitized minute step.

Half-step ties round upward. The final value is clamped to 23:59 instead of wrapping into the next day.

ยงExamples

use ailloli_ui_core::TimeValue;
use ailloli_ui_core::time_picker::snap_time;

assert_eq!(snap_time(TimeValue::new(10, 8), 5), TimeValue::new(10, 10));