parent
b5a249b756
commit
7a6fdbef14
1 changed files with 13 additions and 2 deletions
15
src/main.rs
15
src/main.rs
|
@ -1,5 +1,5 @@
|
|||
use jiff::tz::TimeZone;
|
||||
use jiff::Timestamp;
|
||||
use jiff::{Timestamp, Unit};
|
||||
use pleroma::Activities;
|
||||
use std::ffi::OsStr;
|
||||
use std::sync::OnceLock;
|
||||
|
@ -227,7 +227,7 @@ markup::define! {
|
|||
|
||||
div[class="activity-content"] {
|
||||
a[href=MAPPINGS.get().unwrap().get(&activity.id).and_then(|url| url.as_ref().map(|url| url.path()))] {
|
||||
time[datetime=&activity.published] { @activity.human_published() }
|
||||
time[datetime=&activity.datetime()] { @activity.human_published() }
|
||||
}
|
||||
|
||||
@if let Some(in_reply_to) = &activity.in_reply_to {
|
||||
|
@ -285,6 +285,17 @@ impl pleroma::Activity {
|
|||
|
||||
published.strftime("%d %b %Y").to_string()
|
||||
}
|
||||
|
||||
/// datetime for `time` element
|
||||
fn datetime(&self) -> String {
|
||||
let published = self
|
||||
.published
|
||||
.parse::<Timestamp>()
|
||||
.map(|ts| ts.round(Unit::Second).expect("rounding to succeeed"))
|
||||
.expect("invalid published value");
|
||||
|
||||
published.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
impl pleroma::Actor {
|
||||
|
|
Loading…
Reference in a new issue