nix-configs/programs/jrnl/src/utils.rs

16 lines
374 B
Rust
Raw Normal View History

use chrono::{DateTime, FixedOffset};
pub fn format_datetime(ts: DateTime<FixedOffset>) -> String {
ts.format("%A, %-d. %B %Y %R").to_string()
}
pub fn format_datetime_padded(ts: DateTime<FixedOffset>) -> String {
format!(
"{:>9}{}{:<9}{}",
ts.format("%A, "),
ts.format("%d. "),
ts.format("%B"),
ts.format(" %Y %R"),
)
}