Pay Dates
Overview
Typically, payments occur on a periodic basis. Each period is typically associated with a number. The basic periods are
given :
- annual - 1
- semi-annual - 2
- quarterly - 4
- bi-monthly -6
- monthly - 12
A given day of the month is specified, such as the 15th of the month, and a first pay date is selected, then the remaining pay dates are
calculated. For exmaple, if the 15th is specified as the pay day, and the period is monthly, then the payment would be contractually
specified for the 15th of each month.
However, there are additional rules that apply. The first consideration that is applied is designed to deal with the issue that
months have different numbers of days in them. That is, if the 31st is chosen as the pay day, there is no 31st day in February.
In such a case, one must decide whether to let the date roll into March, or to move it back to the end of February.
The
end of month rule specifies that when a date extends past the end of the month, to move the date back to the end of month.
As an example, if
the first payment is 2000-01-31 and the number of payments per year is 12, i.e. a payment every month,
then the second payment would occur on 2000-02-31, which does not exist. If the end of month rule is set,
then this payment would occur on 2000-02-29, otherwise it will overflow to 2000-03-02.
Implementation
The davinci library contains the
pay-dates module,
which will compute a set of pay dates given a set of inputs,
such as the following
let pd = await import('/lib/finance/fixed-income/v1.0.0/pay-dates.mjs');
/*
firstDate is a string in format "YYYY-MM-DD" - required
numberOfPaydates is a integer - required
period is an integer - number of payments per year, set to 2 by default
endOfMonth is true or false, set to true by default
*/
let dates = pd.dates(firstDate, numberOfPaydates, period, endOfMonth);
The following computes 12 semi-annual pay dates, starting at '2000-01-15', using the end of month rule
let pd = await import('/lib/finance/fixed-income/v1.0.0/pay-dates.mjs');
let dates = pd.dates('2000-01-15', 12, 2, true);
Try it!