Crate emoji_clock_2

Source
Expand description

ยงExamples

#[cfg(feature = "time")]
{
  use time::Time;
  use emoji_clock_2::{Clock, Rounding};
  let clock = Clock::new(Time::from_hms(12, 29, 00).unwrap()).with_rounding(Rounding::Floor);
  assert_eq!("๐Ÿ•›", clock.to_string());
}
#[cfg(feature = "chrono")]
{
  use chrono::NaiveTime;
  use emoji_clock_2::{Clock, Meridiem};
  let am_clock = Clock::new(NaiveTime::from_hms_opt(9, 15, 00).unwrap()).with_meridiem(Meridiem::default());
  assert_eq!("๐Ÿ•ค๐ŸŒž", am_clock.to_string());
  let pm_clock = Clock::new(NaiveTime::from_hms_opt(21, 44, 00).unwrap()).with_meridiem(Meridiem{ am: '๐ŸŒž', pm: '๐ŸŒ™' });
  assert_eq!("๐Ÿ•ค๐ŸŒ™", pm_clock.to_string());
}

Structsยง

Clock
Renders a clock in emoji
Meridiem
Meridiem (AM/PM) indicators

Enumsยง

Rounding
Strategies for rounding time to emoji clock precision (30-minute granularity)

Traitsยง

TimeLike
The common set of methods for time

Functionsยง

clock_emoji
Returns the emoji clock with the correct hour hand and minute hand, accurate to 30-minute precision