You are here

public static function DateTimeHelper::getMonthLabelByNumber in Content Planner 8

Get Month label by its number.

Parameters

int $number:

Return value

bool|mixed

1 call to DateTimeHelper::getMonthLabelByNumber()
Calendar::buildCalendarDataStructure in modules/content_calendar/src/Component/Calendar.php
Build data structure for Calendar.

File

modules/content_calendar/src/DateTimeHelper.php, line 26

Class

DateTimeHelper

Namespace

Drupal\content_calendar

Code

public static function getMonthLabelByNumber($number) {
  if (is_numeric($number) && ($number >= 1 && $number <= 12)) {
    $month_labels = [
      1 => t('January'),
      2 => t('February'),
      3 => t('March'),
      4 => t('April'),
      5 => t('May'),
      6 => t('June'),
      7 => t('July'),
      8 => t('August'),
      9 => t('September'),
      10 => t('October'),
      11 => t('November'),
      12 => t('December'),
    ];
    return $month_labels[$number];
  }
  return FALSE;
}