diff options
author | Stefan Pöschel <[email protected]> | 2023-04-15 12:42:37 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-05-07 09:32:44 +0200 |
commit | c3662aedfb4e7bc28710a461fd643542c0ee8cd3 (patch) | |
tree | 5a7abe547476cf6456afc5a0fa869888180d5129 /libcaja-private | |
parent | 676e28188ce3bef375acf9b051b230485928a99c (diff) | |
download | caja-c3662aedfb4e7bc28710a461fd643542c0ee8cd3.tar.bz2 caja-c3662aedfb4e7bc28710a461fd643542c0ee8cd3.tar.xz |
caja-file: fix yesterday/today informal date bug
If informal date format is used, the yesterday/today ranges of 48/24
hours apply to the end of the current day, not to the current instant.
Fixes a regression introduced by 476f56a25be636970b336d525a7766b6d1eb3fff.
Fixes #1621.
Diffstat (limited to 'libcaja-private')
-rw-r--r-- | libcaja-private/caja-file.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c index a495e1e9..97cbb9ec 100644 --- a/libcaja-private/caja-file.c +++ b/libcaja-private/caja-file.c @@ -4848,7 +4848,7 @@ caja_file_fit_date_as_string (CajaFile *file, char *date_string; gchar *result = NULL; int i; - GDateTime *date_time, *today; + GDateTime *date_time, *today, *end_of_today; GTimeSpan file_date_age; if (!caja_file_get_date (file, date_type, &file_time_raw)) { @@ -4866,9 +4866,15 @@ caja_file_fit_date_as_string (CajaFile *file, } today = g_date_time_new_now_local (); - file_date_age = g_date_time_difference (today, date_time); + end_of_today = g_date_time_add_full (today, 0, 0, 1, + -1 * g_date_time_get_hour (today), + -1 * g_date_time_get_minute (today), + -1.0 * g_date_time_get_seconds (today)); g_date_time_unref (today); + file_date_age = g_date_time_difference (end_of_today, date_time); + g_date_time_unref (end_of_today); + /* Format varies depending on how old the date is. This minimizes * the length (and thus clutter & complication) of typical dates * while providing sufficient detail for recent dates to make |