propertiesView: Unify localized DateTime format

Closes #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/141>
This commit is contained in:
Sophie Herold 2023-03-14 02:27:31 +01:00 • committed by Marge Bot
parent b8d5f833f3
commit e93020d9ab
3 changed files with 20 additions and 8 deletions

View file

@ -355,16 +355,14 @@ impl LpPropertiesView {
#[template_callback]
fn created_date(&self, info: Option<gio::FileInfo>) -> String {
info.and_then(|i| i.creation_date_time())
.and_then(|t| t.format("%x, %X").ok())
.map(|t| t.to_string())
.and_then(|t| util::datetime_fmt(&t))
.unwrap_or_else(|| FALLBACK.to_owned())
}
#[template_callback]
fn modified_date(&self, info: Option<gio::FileInfo>) -> String {
info.and_then(|i| i.modification_date_time())
.and_then(|t| t.format("%x, %X").ok())
.map(|t| t.to_string())
.and_then(|t| util::datetime_fmt(&t))
.unwrap_or_else(|| FALLBACK.to_owned())
}