public static function DateHelper::weekDaysOrdered

Reorders weekdays to match the first day of the week.

Parameters

array $weekdays: An array of weekdays.

Return value

array An array of weekdays reordered to match the first day of the week.

File

drupal/core/modules/datetime/lib/Drupal/datetime/DateHelper.php, line 261
Contains \Drupal\datetime\DateHelper.

Class

DateHelper
Defines Gregorian Calendar date values.

Namespace

Drupal\datetime

Code

public static function weekDaysOrdered($weekdays) {
  $first_day = config('system.date')
    ->get('first_day');
  if ($first_day > 0) {
    for ($i = 1; $i <= $first_day; $i++) {
      $last = array_shift($weekdays);
      array_push($weekdays, $last);
    }
  }
  return $weekdays;
}