Skip to content

Don't move explicit stub dates to the end of the month - #3031

Merged
lballabio merged 1 commit into
lballabio:masterfrom
sohailshk:fix/schedule-eom-stub-dates
Nov 13, 2026
Merged

lballabio merged 1 commit into
lballabio:masterfrom
sohailshk:fix/schedule-eom-stub-dates

Conversation

@sohailshk

Copy link
Copy Markdown
Contributor

When endOfMonth is set and the schedule is generated from an end-of-month seed, Schedule moves every inner date to the end of its month. This includes an explicit firstDate or nextToLastDate, so the stub that was asked for is silently changed. For example,

Schedule s = MakeSchedule().from(Date(31, January, 2026))
                           .to(Date(15, December, 2027))
                           .withNextToLastDate(Date(15, November, 2027))
                           .withCalendar(NullCalendar())
                           .withTenor(6*Months)
                           .withConvention(Unadjusted)
                           .forwards()
                           .endOfMonth();

ends with July 31st, 2027, November 30th, 2027 and December 15th, 2027 instead of having the short final stub start on November 15th. Going backwards, a firstDate of February 15th, 2026 becomes February 28th. With a business-day convention the date can even move to the next month: a first date of February 27th, 2026 (the last TARGET business day of the month) is moved to the 28th and then rolled to March 2nd by Following.

The cause is the end-of-month pass at the end of the rule-based constructor, which applies Date::endOfMonth to all inner dates. The explicit stub dates are now only adjusted by the business-day convention, as #1509 already does for the effective and termination dates; regular dates are still moved to the end of the month.

The new test case ScheduleTests/testStubDatesWithEomAdjustment covers the three cases above. It fails on master with the dates quoted here and passes with the change; the other schedule tests and the full test suite pass.

With endOfMonth set and an end-of-month seed, Schedule moved every inner date to the end of its month, including an explicit firstDate or nextToLastDate. A short final stub ending on November 15th ended on November 30th instead, and a first date on the last business day of February could be rolled into March by a Following convention.

Explicit stub dates are now only adjusted by the business-day convention, as was already the case for the effective and termination dates.
@CLAassistant

CLAassistant commented Nov 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 79.731% (+0.002%) from 79.729% — sohailshk:fix/schedule-eom-stub-dates into lballabio:master

@lballabio
lballabio merged commit a2037d8 into lballabio:master Nov 13, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants