Compare with today and return a color (too late, today, on time)
@param DT $date
@param string $colorBefore
@param string $colorToday
@param string $colorAfter
@return string
762850
public static function getDateColor(DT $date, string $colorBefore = 'orange', string $colorToday = 'blue', string $colorAfter = 'green')
    {
        $time = time();
        if ($date->format('dmY') == date('dmY', $time)) {
            return $colorToday;
        }
        return $date->getTimestamp() > $time ? $colorAfter : $colorBefore;
    }
49418
public static boolean beforeNow(String date, String format, DateUnit dateUnit) {
        logger.debug("指定日期为：{}", date);
        return calc(new Date(), parse(date, format), dateUnit) > 0;
    }
361774
protected void setDate(Date date, boolean firePropertyChange) {
		Date oldDate = this.date;
		this.date = date;

		if (date == null) {
			setText("");
		} else {
			String formattedDate = dateFormatter.format(date);
			try {
				setText(formattedDate);
			} catch (RuntimeException e) {
				e.printStackTrace();
			}
		}
		if (date != null && dateUtil.checkDate(date)) {
			setForeground(Color.BLACK);

		}

		if (firePropertyChange) {
			firePropertyChange("date", oldDate, date);
		}
	}
530309
function setColOrder($orderedBaseColNames, $groupPrefix = null) {
    $this->columns->setOrder($orderedBaseColNames, $groupPrefix);
    return $this;
  }
837196
public function datefromApi($date, $std = false) {
         $object = \DateTime::createFromFormat(API::API_DATE_FORMAT, $date);
      
          if ($std) {
            return getdate($object->getTimestamp());
          }

          return $object;
        }
908492
protected Date getTimeAfter (final Date afterTime)
  {
    return (m_aCronEx == null) ? null : m_aCronEx.getTimeAfter (afterTime);
  }
701536
public void setForeground(Color foreground) {
		super.setForeground(foreground);

		if (days != null) {
			for (int i = 7; i < 49; i++) {
				days[i].setForeground(foreground);
			}

			drawDays();
		}
	}
1347255
private function getClosestDayAfter($dayNumber)
    {
        if (null !== $day = $this->getDay($dayNumber)) {
            return $day;
        }

        return $this->getDayAfter($dayNumber);
    }
822354
public static function getForegroundCode($foregroundColour)
    {
        if (!isset(self::$foreground_colours[$foregroundColour])) {
            throw new \Exception('Invalid foreground colour.');
        }
        return "\033[" . self::$foreground_colours[$foregroundColour] . 'm';
    }
593596
public function getBackgroundColorEscapeSequence ( $colorName = '' ) {
        if ( $this->_isDefinedColor($colorName) === true ) {
            $colors = self::getDefinedColors();
            list($textColor, $backgroundColor) = $colors[$colorName];
            return $backgroundColor;
        }
        return '';
    }
42459
public static Date getDateOfSecondsBack(final int secondsBack, final Date date) {

    return dateBack(Calendar.SECOND, secondsBack, date);
  }
1051556
public function checkBefore($date, $latest)
    {
        try {
            return $this->toTimestamp($date) < $this->toTimestamp($latest);
        } catch (InvalidArgumentException $e) {
            return false;
        }
    }
530290
private function getDateBefore(\DateTime $date)
    {
        $tmpDate = clone $date;
        $tmpDate->modify('-1 day');

        $dayOfWeek = (int) $tmpDate->format('N');
        $closestDay = $this->getClosestDayBefore($dayOfWeek);

        if ($closestDay->getDayOfWeek() !== $dayOfWeek) {
            $tmpDate->modify(sprintf('last %s', Days::toString($closestDay->getDayOfWeek())));
        }

        return $tmpDate;
    }
931790
public static Date getDayBegin(Date date) {
        String format = DateFormatUtils.format(date, DATE_PATTERN);
        return parseDate(format.concat(" 00:00:00"));
    }
1361906
private function getClosestDayBefore($dayNumber)
    {
        if (null !== $day = $this->getDay($dayNumber)) {
            return $day;
        }

        return $this->getDayBefore($dayNumber);
    }
131716
public static function textDate($date)
    {
        $date = Helper::date("U", $date);

        $diff = Helper::dateDiff($date, time());

        $text = "";

        # If the difference is less than 1 full day then claim it was today
        if ($diff < 1) {
            $text .= "Today";

        # If it's more than 1 day, but less then 2 then claim it was yesterday
        } elseif ($diff < 2) {
            $text .= "Yesterday";

        # If was over a month ago then display a date
        } elseif ($diff > 30) {
            $text .= date("D jS M", $date);
            $year = date("Y", $date);
            if ($year < date("Y")) {
                $text.= " " . $year;
            }

        # Otherwise display how many days ago it was
        } else {
            $text .= $diff . " days ago";
        }

        $text .= " at " . date("g:ia", $date);

        return $text;
    }
1192152
public static function beforeDate($val, $beforeDate = '', $symbol = '<'): bool
    {
        if (!$val || !\is_string($val)) {
            return false;
        }

        if (!$valueTime = \strtotime($val)) {
            return false;
        }

        $beforeTime = $beforeDate ? \strtotime($beforeDate) : \time();

        if ($symbol === '<') {
            return $valueTime < $beforeTime;
        }

        return $valueTime <= $beforeTime;
    }