Suggestion: CalendarDays TimeUnit
Author: eltoderCreated Sep 24, 2026Updated Sep 28, 2026
Hi @lballabio. I wanted to get your thoughts on the following suggestion.
Currently, we only have one time unit for days (Days). Some methods interpret this as calendar days (usually Period's methods) and some as business days (usually Calendar's methods). This causes some confusion. For example, Period::normalize() can normalize Days into Weeks, so is not safe to use if Days may mean business days. This also means one need to be careful to do calendar.adjust(date + period) instead of calendar.advance(date, period) if they need calendar days. So the suggestion is to
- Add a
CalendarDaysor (CalDays)TimeUnit. - Make
Calendar::advance()treat it as calendar days. - Change
Period::normalize()to use the current logic for CalendarDays and leave Days alone. - Change comparisons on Period to treat Days as business days.
Source: lballabio/QuantLib