Skip to content

Instantly share code, notes, and snippets.

@hakimkal
Created August 1, 2021 20:11
Show Gist options
  • Select an option

  • Save hakimkal/4bea43af4c5eacb5d97655409bd1b38f to your computer and use it in GitHub Desktop.

Select an option

Save hakimkal/4bea43af4c5eacb5d97655409bd1b38f to your computer and use it in GitHub Desktop.
object PeriodHelper {
def computeEndDate(periodNum: Long, periodType: RecurringInterval) = {
val days: Long = periodType match {
case RecurringInterval.DAY => 1 * periodNum
case RecurringInterval.WEEK => 7 * periodNum
case RecurringInterval.MONTH => 28 * periodNum
case RecurringInterval.YEAR => 365 * periodNum
case _ => 0 * periodNum
}
LocalDate.now().plusDays(days)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment