gnucash stable: [gnc-dense-cal.c] sx popup: show date in preference (cf.locale) format
Christopher Lam
clam at code.gnucash.org
Mon Mar 18 01:11:35 EDT 2024
Updated via https://github.com/Gnucash/gnucash/commit/0deb5397 (commit)
from https://github.com/Gnucash/gnucash/commit/9cc31f32 (commit)
commit 0deb539779947c9bdcbd06b1b9e5c4e1ee8761bc
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Mar 18 13:03:39 2024 +0800
[gnc-dense-cal.c] sx popup: show date in preference (cf.locale) format
because the date format preference is user-facing and
customisable. it's jarring if the preference is dd/mm/yyyy and the
display shows mm/dd/yyyy in accordance to the locale.
diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 5a2af608d4..f46a70d45c 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -1246,8 +1246,6 @@ populate_hover_window(GncDenseCal *dcal)
{
GtkWidget *w;
GDate *date;
- static const int MAX_STRFTIME_BUF_LEN = 64;
- gchar strftimeBuf[MAX_STRFTIME_BUF_LEN];
if (dcal->doc >= 0)
{
@@ -1262,9 +1260,13 @@ populate_hover_window(GncDenseCal *dcal)
* %Y-%m-%d) is not a good idea here since many
* locales will want to use a very different date
* format. Please leave the specification of the date
- * format up to the locale and use %x here. */
- g_date_strftime(strftimeBuf, MAX_STRFTIME_BUF_LEN - 1, "%x", date);
- gtk_label_set_text(GTK_LABEL(w), strftimeBuf);
+ * format up to the preference. */
+ time64 t64 = gnc_dmy2time64_neutral (g_date_get_day(date),
+ g_date_get_month(date),
+ g_date_get_year(date));
+ gchar date_buff [MAX_DATE_LENGTH + 1];
+ qof_print_date_buff (date_buff, MAX_DATE_LENGTH, t64);
+ gtk_label_set_text (GTK_LABEL(w), date_buff);
o = G_OBJECT(dcal->transPopup);
model = GTK_LIST_STORE(g_object_get_data(o, "model"));
Summary of changes:
gnucash/gnome-utils/gnc-dense-cal.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
More information about the gnucash-changes
mailing list