function DateHelper::weekDaysAbbr2

Same name in other branches
  1. 9 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDaysAbbr2()
  2. 8.9.x core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDaysAbbr2()
  3. 10 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDaysAbbr2()

Constructs a translated array of 2-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 2 letter abbreviations

File

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

Class

DateHelper
Defines Gregorian Calendar date values.

Namespace

Drupal\Core\Datetime

Code

public static function weekDaysAbbr2($required = FALSE) {
    $weekdays = [
        t('Su', [], [
            'context' => 'Abbreviated weekday',
        ]),
        t('Mo', [], [
            'context' => 'Abbreviated weekday',
        ]),
        t('Tu', [], [
            'context' => 'Abbreviated weekday',
        ]),
        t('We', [], [
            'context' => 'Abbreviated weekday',
        ]),
        t('Th', [], [
            'context' => 'Abbreviated weekday',
        ]),
        t('Fr', [], [
            'context' => 'Abbreviated weekday',
        ]),
        t('Sa', [], [
            'context' => 'Abbreviated weekday',
        ]),
    ];
    $none = [
        '' => '',
    ];
    return !$required ? $none + $weekdays : $weekdays;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.