public static function getMonthsToLastPlannedRelease()

in app/classes/ReleaseInsights/CalendarMonthly.php [18:43]


    public static function getMonthsToLastPlannedRelease(): array
    {
        $start = new DateTime('now')->modify('first day of this month');

        /* For unit tests which work on stale data, we fake a past date */
        if (defined('TESTING_CONTEXT')) {
            $start = new DateTime('2023-11-01');
        }

        /* The end date is the last planned major release */
        $end = array_key_last(new Data()->getFutureReleases());
        $end = new Data()->getFutureReleases()[$end];
        $end = new DateTime($end)->modify('first day of next month');
        $period = new DatePeriod(
            $start,
            DateInterval::createFromDateString('1 month'),
            $end
        );

        $upcoming_months = [];
        foreach ($period as $month) {
            $upcoming_months[] = $month->format("Y-m-d");
        }

        return $upcoming_months;
    }