Skip to content

Instantly share code, notes, and snippets.

@yowainwright
Created December 9, 2017 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yowainwright/1fe03cb6cf95193d0bfe185a494d3273 to your computer and use it in GitHub Desktop.
Save yowainwright/1fe03cb6cf95193d0bfe185a494d3273 to your computer and use it in GitHub Desktop.
Input Frequency
switch (inputFrequency) {
case 1:
date = this.nextBillDateIsWithinOneMonth(nextBillDate) ?
moment(nextBillDate) : moment(nextBillDate).subtract(1, 'month')
break
case > initialFrequency:
newFrequencyDelta = (inputFrequency - initialFrequency)
date = moment(nextBillDate).add(newFrequencyDelta, 'month')
break
default:
date = moment(nextBillDate).add(1, 'month')
break
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment