This commit is contained in:
2026-08-11 13:30:09 +07:00
parent e77cfe29d9
commit 6f381c68c3
8 changed files with 261 additions and 9 deletions
+1 -1
View File
@@ -2,4 +2,4 @@ mod pubkey;
mod time;
pub use pubkey::shorten_pubkey;
pub use time::relative_time;
pub use time::{relative_time, relative_time_secs};
+5
View File
@@ -20,6 +20,11 @@ pub fn relative_time(timestamp: Timestamp) -> String {
}
}
/// Format a unix timestamp in seconds as a short relative time (e.g. "3h ago").
pub fn relative_time_secs(secs: i64) -> String {
relative_time(Timestamp::from_secs(secs.max(0) as u64))
}
#[cfg(test)]
mod tests {
use super::*;