web: better date formatting
This commit is contained in:
parent
02e16b4547
commit
1cdabc348b
@ -47,7 +47,7 @@ iframe {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.index .date {
|
||||
width: 7em;
|
||||
width: 10em;
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ use std::{
|
||||
hash::{Hash, Hasher},
|
||||
};
|
||||
|
||||
use chrono::{DateTime, Duration, Local, Utc};
|
||||
use chrono::{DateTime, Datelike, Duration, Local, Utc};
|
||||
use graphql_client::GraphQLQuery;
|
||||
use itertools::Itertools;
|
||||
use log::{debug, error, info, Level};
|
||||
@ -708,8 +708,10 @@ fn human_age(timestamp: i64) -> String {
|
||||
ts.format("Yest. %H:%M").to_string()
|
||||
} else if age < Duration::weeks(1) {
|
||||
ts.format("%a %H:%M").to_string()
|
||||
} else if ts.year() == now.year() {
|
||||
ts.format("%b %d %H:%M").to_string()
|
||||
} else {
|
||||
ts.format("%b %e %H:%M").to_string()
|
||||
ts.format("%b %d, %Y %H:%M").to_string()
|
||||
};
|
||||
datetime
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user