Skip to content

Commit

Permalink
Fix #2806
Browse files Browse the repository at this point in the history
  • Loading branch information
JC5 committed Nov 9, 2019
1 parent e3418b1 commit adc4b00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Support/Navigation.php
Expand Up @@ -83,14 +83,15 @@ public function addPeriod(Carbon $theDate, string $repeatFreq, int $skip): Carbo
$date->$function($add);

// if period is 1M and diff in month is 2 and new DOM > 1, sub a number of days:
// AND skip is 1
// result is:
// '2019-01-29', '2019-02-28'
// '2019-01-30', '2019-02-28'
// '2019-01-31', '2019-02-28'

$months = ['1M', 'month', 'monthly'];
$difference = $date->month - $theDate->month;
if (2 === $difference && $date->day > 0 && in_array($repeatFreq, $months, true)) {
if (1 === $add && 2 === $difference && $date->day > 0 && in_array($repeatFreq, $months, true)) {
$date->subDays($date->day);
}

Expand Down

0 comments on commit adc4b00

Please sign in to comment.