Boost logo

Boost Users :

From: Bill Moo (mookimoo73_at_[hidden])
Date: 2019-07-10 13:21:26


I can’t understand what, if indeed anything, I am doing wrong here.
Using boost 1.69 on Arch Linux I am trying to use a
gregorian::week_iterator to iterate a gregorian date_period that has a
length of 365 which produces this output:

Starts 2018-07-10 Ends 2019-07-10 true false true 365

>From this code:

boost::gregorian::date_period dp{ m_Start, m_Ends } ;
BOOST_LOG(lg) << "Starts " <<
boost::gregorian::to_iso_extended_string(dp.begin()) << " Ends " <<
boost::gregorian::to_iso_extended_string(dp.end()) << " " << isYear <<
" " << isMonth << " " << isWeek << " " << dp.length() ;

The following is the code I am using to iterate the date_period:

for(boost::gregorian::week_iterator wi = dp.begin(); wi != dp.end(); ++wi) {
    items.push_back(formatParams(pi, (*wi))) ;
}

However, when this code executes it eventually fails with the following error:
Year is out of valid range: 1400..9999

In my formatParams method the code generates the correct strings, but
it doesn’t stop at Jun 2019 as I’d expect but continues to run out to
2375!

I would appreciate some feedback on this as I have identical code that
uses a gregorian::month_iterator and this generates the 12 items from
the same date_period range as I’d expect.

--
Bill

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net