Crates.io | emoji-clock-2 |
lib.rs | emoji-clock-2 |
version | 0.2.0 |
source | src |
created_at | 2024-03-02 16:07:46.654847 |
updated_at | 2024-03-04 21:48:54.981982 |
description | Convert time and chrono types to emojis |
homepage | https://github.com/GuillerLT/emoji-clock-2 |
repository | https://github.com/GuillerLT/emoji-clock-2 |
max_upload_size | |
id | 1159800 |
size | 16,847 |
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.