public static function OfficeHoursDateHelper::weekDaysByFormat in Office Hours 8
Initializes day names, using date_api as key (0=Sun, 6=Sat).
Be careful: date_api uses PHP: 0=Sunday and DateObject uses ISO: 1=Sunday.
Parameters
string $format: The requested format.
Return value
array A list of weekdays in the requested format.
2 calls to OfficeHoursDateHelper::weekDaysByFormat()
- OfficeHoursFormatterTrait::formatLabels in src/
OfficeHoursFormatterTrait.php - Formatter: format the day name.
- office_hours_tokens in ./
office_hours.tokens.inc - Implements hook_tokens().
File
- src/
OfficeHoursDateHelper.php, line 219
Class
- OfficeHoursDateHelper
- Defines lots of helpful functions for use in massaging dates.
Namespace
Drupal\office_hoursCode
public static function weekDaysByFormat($format) {
$days = [];
switch ($format) {
case 'number':
$days = range(1, 7);
break;
case 'none':
$days = array_fill(0, 7, '');
break;
case 'long':
$days = self::weekDays(TRUE);
break;
case 'two_letter':
// @todo Avoid translation from English to XX, in case of 'Microdata'.
$days = self::weekDaysAbbr2(TRUE);
break;
case 'short':
// three-letter.
default:
$days = self::weekDaysAbbr(TRUE);
break;
}
return $days;
}