Skip to content

Commit

Permalink
feat: slack date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniiriarios committed Feb 17, 2023
1 parent a879e98 commit 9498749
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ impl ChannelData {
pub fn last_message_ts_formatted(&self) -> String {
let t: i64 = self.last_message_ts;
if t == 0 { return "[unable to parse timestamp]".to_string() }
NaiveDateTime::from_timestamp_opt(t, 0).unwrap().format("%b %d, %Y").to_string()
let fallback = NaiveDateTime::from_timestamp_opt(t, 0).unwrap().format("%b %d, %Y UTC");
format!("<!date^{}^{{date_short}}|{}>", t, fallback)
}
}

0 comments on commit 9498749

Please sign in to comment.