Pay Dates Javascript 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('/code/pay-dates/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('/code/pay-date/v1.0.0/pay-dates.mjs');
let dates = pd.dates('2000-01-15', 12, 2, true);