~core/calstr

aec29833731ab7766a598800642acef5b719a00f — core 16 hours ago 3c309e6
fix: incorrect time delta calculation
1 files changed, 6 insertions(+), 3 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +6 -3
@@ 52,10 52,13 @@ fn is_soon(td: TimeDelta) -> bool { td <= TimeDelta::hours(6) }
fn is_ending_imminent(td: TimeDelta) -> bool { td <= TimeDelta::minutes(30) }

fn format_time_delta(td: TimeDelta) -> String {
    if td.num_hours() == 0 {
        format!("{}m", td.num_minutes())
    let total_mins = (td.num_seconds() + 59) / 60;
    let hours = total_mins / 60;
    let mins = total_mins % 60;
    if hours == 0 {
        format!("{}m", mins)
    } else {
        format!("{}h{}m", td.num_hours(), td.num_minutes() % 60)
        format!("{}h{}m", hours, mins)
    }
}