[][src]Function ms_converter::get_max_possible_duration

pub fn get_max_possible_duration(milliseconds: i64) -> Result<String, Error>

Getting human-like time from milliseconds. get_max_possible_duration function gets a milliseconds count and returns a max possible string with your time. get_max_possible_duration has some limitations maximum of avalable postfixes is a day.

Usage

use crate::ms_converter::{get_max_possible_duration, WEEK};

let value = get_max_possible_duration(2 * WEEK as i64).unwrap();
assert_eq!(value, "14d") // Max possible period is a day

also you can a pass negative values

use crate::ms_converter::{get_max_possible_duration, WEEK};

let value = get_max_possible_duration(-2 * WEEK as i64).unwrap();
assert_eq!(value, "-14d") // Max possible period is a day