Compare commits

..

No commits in common. "6901c9fde9f78bdbfc78772fc897dd3370dabc63" and "f6c1835b1866d4e3b46a8001cc327c436aead721" have entirely different histories.

2 changed files with 6 additions and 9 deletions

View File

@ -47,7 +47,7 @@ iframe {
white-space: nowrap;
}
.index .date {
width: 7em;
width: 6em;
white-space: nowrap;
text-align: right;
}

View File

@ -484,24 +484,21 @@ fn pretty_authors(authors: &str) -> impl Iterator<Item = Node<Msg>> + '_ {
fn human_age(timestamp: i64) -> String {
let now = Local::now();
let yesterday = now - Duration::days(1);
let ts = DateTime::<Utc>::from_timestamp(timestamp, 0)
.unwrap()
.with_timezone(&Local);
let age = now - ts;
let weekday = now.weekday();
let datetime = if age < Duration::minutes(1) {
format!("{} min. ago", age.num_seconds())
format!("{} ago", age.num_seconds())
} else if age < Duration::hours(1) {
format!("{} min. ago", age.num_minutes())
} else if ts.date_naive() == now.date_naive() {
ts.format("Today %H:%M").to_string()
} else if ts.date_naive() == yesterday.date_naive() {
ts.format("Yest. %H:%M").to_string()
format!("{} ago", age.num_minutes())
} else if age < Duration::days(1) {
ts.format("%H:%M").to_string()
} else if age < Duration::weeks(1) {
ts.format("%a %H:%M").to_string()
} else {
ts.format("%b %e %H:%M").to_string()
ts.format("%b %e").to_string()
};
info!("dateime {datetime} TZ: {}", ts.offset());
datetime