public static function DateHelper::weekDays in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDays()
- 9 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDays()
Returns a translated array of week names.
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 names
File
- core/
lib/ Drupal/ Core/ Datetime/ DateHelper.php, line 161
Class
- DateHelper
- Defines Gregorian Calendar date values.
Namespace
Drupal\Core\DatetimeCode
public static function weekDays($required = FALSE) {
$weekdays = [
t('Sunday'),
t('Monday'),
t('Tuesday'),
t('Wednesday'),
t('Thursday'),
t('Friday'),
t('Saturday'),
];
$none = [
'' => '',
];
return !$required ? $none + $weekdays : $weekdays;
}