Overview
In addition to the end of month rule , there are additional rules to adjust the pay dates that may apply. Usually, the payment dates as specified above are fixed. However, the payment date may exist on holiday or weekend. In such a case, the payment may be made on a date, other than the specified payment date. (We call this the pay date, as opposed to payment date). The process of calculating the pay date from a payment date is known as date rolling.
The method of date rolling is specified with the bond. The following are common date rolling methods.
- actual - pay date equals the payment date
- following - pay date is the next business after the payment date
- previous - pay date is the prior business date before the payment date
- modified following - pay date is the next business day after the payment date, unless it occurs in the next month, in which case it is the previous business day
- modified previous - pay date is the previous business day before the payment date, unless it occurs in the previous month, in which case it is the next business date.
Implementation
The davinci library contains the pay-dates module, which will provides a date rolling function.
let pd = await import('/lib/finance/fixed-income/v1.0.0/pay-dates.mjs');
let date = pd.dateRoll('2004-01-31', 'following', pd.days.weekdays);