GNOME Bugzilla – Bug 104844
Scheduled Transactions on 31st/last put in following month
Last modified: 2018-06-29 20:26:45 UTC
I am trying to set up a payroll deposit as a scheduled transaction which takes plast on the last day of the month. I took the one for tomorrow and, from my checking account ledger, clicked on the "Schedule" icon to use it as a template. I went into advanced to tell GnuCash to enter the transaction automatically, 14 days in advance, and to make the take the 31st/last. It had automatically selected placing the transaction on 28 Feb 2003 as the next entry, and I left that. After selecting "okay" to enter the transaction, the list of scheduled transactions showed this as being scheduled for 3 March 2003. Thinking I has misentered it due to mouse sloppiness, I reopened the advanced dialogue and re-entered it as the 31st/last. Once again, after clicking "okay", the transaction shows as being scheduled on 3 March 2003.
Here is the SX that ended up in my gnucash.data <gnc:schedxaction version="1.0.0"> <sx:id type="guid">c2a92113e76bf69786ba2ca26eb2adf1</sx:id> <sx:name>Roland's Paycheck (IDC)</sx:name> <sx:autoCreate>y</sx:autoCreate> <sx:autoCreateNotify>n</sx:autoCreateNotify> <sx:advanceCreateDays>14</sx:advanceCreateDays> <sx:advanceRemindDays>0</sx:advanceRemindDays> <sx:instanceCount>1</sx:instanceCount> <sx:start> <gdate>2003-02-28</gdate> </sx:start> <sx:templ-acct type="guid">f4f881a162281bfc66790b4e3fab64f1</sx:templ-acct> <sx:freqspec> <gnc:freqspec version="1.0.0"> <fs:id type="guid">9ff4239cbddefeb9ebc644ae155c570f</fs:id> <fs:ui_type>monthly</fs:ui_type> <fs:monthly> <fs:interval>1</fs:interval> <fs:offset>0</fs:offset> <fs:day>3</fs:day> </fs:monthly> </gnc:freqspec> </sx:freqspec> </gnc:schedxaction>
*** Bug 106254 has been marked as a duplicate of this bug. ***
I cannot reproduce this, nor can I see in the code where it's happening. Can someone provide a different sequence of instructions which does reproduce this? In the course of doing that, does the calendar appear correct?
I'm running GnuCash 1.8.10 on Gentoo Linux, and I'm experiencing this problem as well. I see a pattern. To reproduce: Go to set up a new scheduled transaction. Select "Monthly" as the Recurrence Frequency Enter a start date in a month with less than 31 days (ie: February, April, June, September or November). Select "On the [31st/last]" Look at the calendar display below it, and you will find the 1st, 2nd or 3rd of the following month highlighted instead of the last day. A similar thing happens with Semi-Monthly frequency, but with a twist: Enter a start date in a month with exactly 31 days (ie: January, March, May, July, August, October or December). Select "On the [31st/last]" for either of the two day selections. Look at the calendar display -- similar behaviour to Monthly as per above. When this problem occurs, selecting the 29th/last, 30th/last and 31st/last actually highlights the 1st, 2nd or 3rd of the following month respectively.
Behavior in 1.9.3 is exactly as described above.
Yeah. We hand "Feb 31 2003" to mktime(...), and it cheerfully does the math for us. :( Luckily, we can use any month with 31 days to setup the FreqSpec; the SX'es start date is separate. Fixed in branches/sx-cleanup/@15375. This probably won't land until 2.2, though.
Merged to trunk@15399. 2.2
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=104844. Please update any external references or bookmarks.