1#![no_std]
10extern crate alloc;
11
12pub use pretty::splitter::Millisecond;
13pub use pretty::{MillisecondFormatter, MillisecondOption};
14
15pub use relative::parser::RelativePart;
16
17pub mod prelude;
18pub mod pretty;
19pub mod relative;
20pub mod weekday;
21
22#[cfg(test)]
23mod tests {
24
25 #[test]
26 fn should_work_always_with_backward_compatiblity() {
27 use crate::prelude::*;
28
29 let dur = core::time::Duration::from_millis(33_023_448_000);
30 assert_eq!("1y 17d 5h 10m 48s", dur.pretty());
31 assert_eq!(
32 "1 year 17 days 5 hours 10 minutes 48 seconds",
33 dur.pretty_with(MillisecondOption::long())
34 );
35 assert_eq!("about a year ago", dur.relative());
36
37 let ms = Millisecond::from_millis(33_023_448_000);
39 assert_eq!("1y 17d 5h 10m 48s", ms.pretty());
40 }
41}