You are here

public static function DateHelper::weekDaysAbbr1 in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDaysAbbr1()
  2. 9 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDaysAbbr1()

Constructs a translated array of 1-letter week day abbreviations.

Parameters

bool $required: (optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.

Return value

array An array of week day 1 letter abbreviations

File

core/lib/Drupal/Core/Datetime/DateHelper.php, line 233

Class

DateHelper
Defines Gregorian Calendar date values.

Namespace

Drupal\Core\Datetime

Code

public static function weekDaysAbbr1($required = FALSE) {
  $weekdays = [
    t('S', [], [
      'context' => 'Abbreviated 1 letter weekday Sunday',
    ]),
    t('M', [], [
      'context' => 'Abbreviated 1 letter weekday Monday',
    ]),
    t('T', [], [
      'context' => 'Abbreviated 1 letter weekday Tuesday',
    ]),
    t('W', [], [
      'context' => 'Abbreviated 1 letter weekday Wednesday',
    ]),
    t('T', [], [
      'context' => 'Abbreviated 1 letter weekday Thursday',
    ]),
    t('F', [], [
      'context' => 'Abbreviated 1 letter weekday Friday',
    ]),
    t('S', [], [
      'context' => 'Abbreviated 1 letter weekday Saturday',
    ]),
  ];
  $none = [
    '' => '',
  ];
  return !$required ? $none + $weekdays : $weekdays;
}