Money.Subscription.next_interval_starts
You're seeing just the function
next_interval_starts
, go back to Money.Subscription module for more information.
Link to this function
next_interval_starts(plan, current_interval_started, options \\ [])
View SourceSpecs
next_interval_starts(Money.Subscription.Plan.t(), Date.t(), Keyword.t()) :: Date.t()
Returns the next interval start date for a plan.
Arguments
plan
is anyMoney.Subscription.Plan.t
:current_interval_started
is theDate.t
that represents the start of the current interval
Returns
The next interval start date as a Date.t
.
Example
iex> plan = Money.Subscription.Plan.new!(Money.new!(:USD, 100), :month)
iex> Money.Subscription.next_interval_starts(plan, ~D[2018-03-01])
~D[2018-04-01]
iex> plan = Money.Subscription.Plan.new!(Money.new!(:USD, 100), :day, 30)
iex> Money.Subscription.next_interval_starts(plan, ~D[2018-02-01])
~D[2018-03-03]