Expands given day names and day ranges to day names only. The day range must be
in "Mon-Fri" format.

@param string[] $days
@return string[]
169730
private static function expandDaysRange(array $days) : array
	{
		static $dayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun',];
		$expandedValues = [];

		foreach ($days as $day) {
			if (Strings::match($day, '~^\w{3}\s*-\s*\w{3}$~u')) {
				list($begin, $end) = Strings::split($day, '~\s*-\s*~');
				$started = FALSE;
				foreach ($dayNames as $dayName) {
					if ($dayName === $begin) {
						$started = TRUE;
					}
					if ($started) {
						$expandedValues[] = $dayName;
					}
					if ($dayName === $end) {
						$started = FALSE;
					}
				}
			} else {
				$expandedValues[] = $day;
			}
		}

		return array_unique($expandedValues);
	}
1122287
public static Date addDays(Date d, int days) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(d);
        cal.add(Calendar.DAY_OF_YEAR, days);
        return cal.getTime();
    }
151363
private function setDaysOfWeekNames() {
		
		if (empty($this->options['locale']['daysOfWeek'])) {
			$this->options['locale']['daysOfWeek'] = Yii::app()->locale->getWeekDayNames('narrow', true);
		}
	}
1008120
public static function monthize($days)
    {
        $now = new \DateTime();
        $end = new \DateTime();

        $duration = new \DateInterval("P{$days}D");

        $diff = $end->add($duration)->diff($now);

        // handle years
        if ($diff->y > 0) {
            $diff->m += 12 * $diff->y;
        }

        return $diff->m;
    }
1188313
public function loadEntriesFromLastDays($days)
    {
        $entries = $this
            ->entryRepository
            ->getEntriesFromLastDays($days);

        foreach ($entries as $entry) {
            $this
                ->metricsBucket
                ->add($entry);
        }

        return $entries;
    }
756239
public static Date addDays(Date date, int days)
   {
      Calendar cal = popCalendar(date);
      cal.add(Calendar.DAY_OF_YEAR, days);
      Date result = cal.getTime();
      pushCalendar(cal);
      return result;   
   }
1013725
public static function setDay($ts = null, $day = 1)
	{
		list($H, $i, $s, $m, $d, $Y) = sfDateTimeToolkit::breakdown($ts);
		
		return mktime($H, $i, $s, $m, $day, $Y);
	}
582066
public static <D extends Comparable> DateExpression<D> addDays(DateExpression<D> date, int days) {
        return Expressions.dateOperation(date.getType(), Ops.DateTimeOps.ADD_DAYS, date, ConstantImpl.create(days));
    }
1110819
public static function getDays() {
        $days = array();
        for ($i = 1; $i <= 31; $i++) {
            if ($i < 10)
                $days[$i] = '0' . $i;
            else
                $days[$i] = $i;
        }
        return $days;
    }
944342
function getDaysNames () {
            var daysNameList = [];
            for (var i = 0; i < 7 ; i++) {
                daysNameList.push(moment().weekday(i).format('ddd'));
            }
            return daysNameList;
        }
650496
public function day($options = array())
    {
        $options = new AnConfig($options);

        $options->append(array(
            'selected' => null,
            'prompt' => true,
        ));

        $days = array_combine(range(1, 31), range(1, 31));
        $selected = $options->selected;
        unset($options->selected);
        $prompt = $options->prompt;
        unset($options->prompt);
        if ($prompt) {
            $array = array(AnTranslator::_('LIB-AN-SELECTOR-SELECT-DAY'));
            $days = AnHelperArray::merge($array, $days);
        }

        return $this->_html->select($options->name, array('options' => $days, 'selected' => $selected), AnConfig::unbox($options));
    }
693930
private function getWeekDays()
    {
        if (empty(self::$weekDays) && ($this->translator instanceof TranslatorInterface)) {
            self::$weekDays = [
                $this->translator->trans('calendar.weekdays.monday', [], 'default'),
                $this->translator->trans('calendar.weekdays.tuesday', [], 'default'),
                $this->translator->trans('calendar.weekdays.wednesday', [], 'default'),
                $this->translator->trans('calendar.weekdays.thursday', [], 'default'),
                $this->translator->trans('calendar.weekdays.friday', [], 'default'),
                $this->translator->trans('calendar.weekdays.saturday', [], 'default'),
                $this->translator->trans('calendar.weekdays.sunday', [], 'default'),
            ];
        }

        return self::$weekDays;
    }
58560
public final function addDays( int $days = 1 )
      : DateTime
   {

      return $this->move( new \DateInterval( 'P' . \abs( $days ) . 'D' ), $days < 0 );

   }
778133
public static function weekdays() : array
    {
        $days     = self::getAll();
        $weekDays = [];

        foreach ($days as $key => $day) {
            if ($day->isWeekDay()) {
                $weekDays[] = $day;
            }
        }

        return $weekDays;
    }
1136032
public function addDay($day)
    {
        $available = array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun');

        foreach ((array) $day as $value) {
            // only accept valid values
            if ( ! in_array($value, $available)) {
                throw new InvalidArgumentException('Day must be a valid value: '.implode(', ', $available));
            }

            $this->days[] = $value;
        }

        return $this;
    }
267547
private function calculateNumberOfDays($numberOfDays)
    {
        $endDate = Carbon::today();
        $startDate = Carbon::today()->subDays($numberOfDays);

        return [$startDate, $endDate];
    }
528295
public static function daysList($days)
    {
        foreach($days as $day)
        {
            // if it isn't negative, it's positive
            $day = ltrim($day, "+");
            $day = trim($day);

            $ordwk = 1;
            $weekday = false;

            if (strlen($day) === 2)
            {
                $weekday = $day;
            }
            else
            {
                list($ordwk, $weekday) = sscanf($day, "%d%s");
            }

            if (!self::weekDay($weekday) || !self::ordWk(abs($ordwk)))
            {
                return false;
            }
        }

        return true;
    }