I'm using QuantLib 1.7.1 and try running these codes:
Date begin(30, September, 2009), end(15, Jun, 2012);
Calendar myCal = Japan();
BusinessDayConvention bdC = BusinessDayConvention(Following);
Period myTenor(6, Months);
DateGeneration::Rule myRule = DateGeneration::Forward;
Schedule mySched(begin, end, myTenor, myCal, bdC, bdC, myRule, true);
std::vector <Date > finalSched = mySched.dates();
BOOST_FOREACH(Date d, finalSched) std::cout << d << std::endl;
I expected to get a schedule whose lower and upper bounds are 30/9/2009 and 15/6/2012 respectively like this:
September 30th, 2009
March 31st, 2010
September 30th, 2010
March 31st, 2011
September 30th, 2011
March 30th, 2012
June 15th, 2012
But I got the result where final payment date is 29/6/2012, which is after the bound I set:
September 30th, 2009
March 31st, 2010
September 30th, 2010
March 31st, 2011
September 30th, 2011
March 30th, 2012
June 29th, 2012
If I set DateGeneration rule to Backward, it will work as expected (the schedule lower bound is 30/9/2009):
September 30th, 2009
December 15th, 2009
June 15th, 2010
December 15th, 2010
June 15th, 2011
December 15th, 2011
June 15th, 2012
Did QuantLib give the result outside the bound in the first case intentionally or is this a bug?