shifty 0.1.7

A simple cli tool to keep track of your shifts at work
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use colored::{ColoredString, Colorize};

pub fn format_time(hours: f32) -> String {
    let mut minute_remainder = ((hours % 1.) * 60.).floor().to_string();
    if minute_remainder.len() < 2 {
        minute_remainder = format!("0{}", minute_remainder);
    }
    return format!("{}:{}", hours.floor(), minute_remainder);
}

pub fn format_money(money: f32, currency: &String) -> ColoredString {
    format!("{:.2}{}", money, currency).green()
}