I need to integrate error handling within this function. It should throw an error when the initialDueDate and/or the interval param is invalid. Any suggestions?
function calculateNextDueDate(initialDueDate, intervalCode) {
if(moment().diff(initialDueDate) < 0)
return initialDueDate;
return calculateNextDueDate(initialDueDate.add(INTERVAL[intervalCode]), intervalCode);
}
via Shirish Dali
No comments:
Post a Comment