#emoji #clock #time #chrono #rounding #convert #meridiem

no-std emoji-clock-2

Convert time and chrono types to emojis

3 unstable releases

0.2.0 Mar 4, 2024
0.1.1 Mar 2, 2024
0.1.0 Mar 2, 2024

#418 in Date and time

Download history

107 downloads per month

MIT license

16KB
369 lines

emoji-clock-2

use time::Time; // feature 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());
use chrono::NaiveTime; // feature chrono
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());

This library is inspired by emoji-clock.

Differences from emoji-clock

  • time and chrono compatibility: supports both chrono and time libraries through features. By default, none are enabled, giving you the freedom to choose.
  • 30-Minute precision: more detailed time representation with double the granularity.
  • Rounding options: round, floor or ceil.
  • no_std

Dependencies

~0–450KB