public static function DateHelper::weekDaysAbbr2 in Drupal 9
Same name and namespace in other branches
- 8 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\DatetimeCode
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;
}