function DateHelper::weekDaysAbbr1

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDaysAbbr1()
  2. 10 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDaysAbbr1()
  3. 11.x 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;
}

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