Browse Source

chore: Remove extra spaces in front of single-digit dates and times

fractal-6
Kévin Commaille 3 years ago
parent
commit
2eeb44aaae
No known key found for this signature in database
GPG Key ID: 29A48C1F03620416
  1. 2
      src/session/model/room/event/mod.rs
  2. 14
      src/session/view/content/room_history/item_row.rs

2
src/session/model/room/event/mod.rs

@ -406,7 +406,7 @@ impl Event {
if local_time.ends_with("am") || local_time.ends_with("pm") {
// Use 12h time format (AM/PM)
datetime.format("%l∶%M %p").unwrap().to_string()
datetime.format("%-l∶%M %p").unwrap().to_string()
} else {
// Use 24 time format
datetime.format("%R").unwrap().to_string()

14
src/session/view/content/room_history/item_row.rs

@ -321,14 +321,16 @@ impl ItemRow {
let fmt = if date.year() == glib::DateTime::now_local().unwrap().year() {
// Translators: This is a date format in the day divider without the
// year. For ex. "Friday, May 5". See the documentation of
// g_date_time_format for the available specifiers: <https://docs.gtk.org/glib/method.DateTime.format.html>
gettext("%A, %B %e")
// year. For example, "Friday, May 5".
// Please use `-` before specifiers that add spaces on single digits.
// See `man strftime` or the documentation of g_date_time_format for the available specifiers: <https://docs.gtk.org/glib/method.DateTime.format.html>
gettext("%A, %B %-e")
} else {
// Translators: This is a date format in the day divider with the year.
// For ex. "Friday, May 5, 2023". See the documentation of
// g_date_time_format for the available specifiers: <https://docs.gtk.org/glib/method.DateTime.format.html>
gettext("%A, %B %e, %Y")
// For ex. "Friday, May 5, 2023".
// Please use `-` before specifiers that add spaces on single digits.
// See `man strftime` or the documentation of g_date_time_format for the available specifiers: <https://docs.gtk.org/glib/method.DateTime.format.html>
gettext("%A, %B %-e, %Y")
};
child.set_label(&date.format(&fmt).unwrap())

Loading…
Cancel
Save