From 13d55f421c239baff5cd5f55a920495322074ff8 Mon Sep 17 00:00:00 2001 From: Joshua Sled Date: Sun, 30 Dec 2007 15:58:03 +0000 Subject: [PATCH] Bug#506429: Correct widget index offset computation for last-day-of-month SXes. BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16769 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnome-utils/gnc-frequency.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gnome-utils/gnc-frequency.c b/src/gnome-utils/gnc-frequency.c index a6032fe44f..05a1c4e75b 100644 --- a/src/gnome-utils/gnc-frequency.c +++ b/src/gnome-utils/gnc-frequency.c @@ -509,9 +509,10 @@ _get_day_of_month_recurrence(GncFrequency *gf, GDate *start_date, int multiplier if (day_of_month_index > LAST_DAY_OF_MONTH_OPTION_INDEX) { GDate *day_of_week_date = g_date_new_julian(g_date_get_julian(start_date)); + GDateWeekday selected_day_of_week = day_of_month_index - LAST_DAY_OF_MONTH_OPTION_INDEX; // increment until we align on the DOW, but stay inside the month g_date_set_day(day_of_week_date, 1); - while (g_date_get_weekday(day_of_week_date) != (day_of_month_index - 30)) + while (g_date_get_weekday(day_of_week_date) != selected_day_of_week) g_date_add_days(day_of_week_date, 1); recurrenceSet(r, multiplier, PERIOD_LAST_WEEKDAY, day_of_week_date); }