public function humanize(string $locale = null): string
	{
		$current = clone($this->currentTime);

		$years   = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_YEAR);
		$months  = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_MONTH);
		$days    = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_DAY_OF_YEAR);
		$hours   = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_HOUR_OF_DAY);
		$minutes = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_MINUTE);

		$phrase = null;

		if ($years !== 0)
		{
			$phrase = lang('Time.years', [abs($years)], $locale);
			$before = $years < 0;
		}
		else if ($months !== 0)
		{
			$phrase = lang('Time.months', [abs($months)], $locale);
			$before = $months < 0;
		}
		else if ($days !== 0 && (abs($days) >= 7))
		{
			$weeks  = ceil($days / 7);
			$phrase = lang('Time.weeks', [abs($weeks)], $locale);
			$before = $days < 0;
		}
		else if ($days !== 0)
		{
			$phrase = lang('Time.days', [abs($days)], $locale);
			$before = $days < 0;
		}
		else if ($hours !== 0)
		{
			$phrase = lang('Time.hours', [abs($hours)], $locale);
			$before = $hours < 0;
		}
		else if ($minutes !== 0)
		{
			$phrase = lang('Time.minutes', [abs($minutes)], $locale);
			$before = $minutes < 0;
		}
		else
		{
			return lang('Time.now', [], $locale);
		}

		return $before
			? lang('Time.ago', [$phrase], $locale)
			: lang('Time.inFuture', [$phrase], $locale);
	}
public function humanize(string $locale = null): string
	{
		$current = clone($this->currentTime);

		$years   = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_YEAR);
		$months  = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_MONTH);
		$days    = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_DAY_OF_YEAR);
		$hours   = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_HOUR_OF_DAY);
		$minutes = $current->fieldDifference($this->testTime, IntlCalendar::FIELD_MINUTE);

		$phrase = null;

		if ($years !== 0)
		{
			$phrase = lang('Time.years', [abs($years)], $locale);
			$before = $years < 0;
		}
		else if ($months !== 0)
		{
			$phrase = lang('Time.months', [abs($months)], $locale);
			$before = $months < 0;
		}
		else if ($days !== 0 && (abs($days) >= 7))
		{
			$weeks  = ceil($days / 7);
			$phrase = lang('Time.weeks', [abs($weeks)], $locale);
			$before = $days < 0;
		}
		else if ($days !== 0)
		{
			$phrase = lang('Time.days', [abs($days)], $locale);
			$before = $days < 0;
		}
		else if ($hours !== 0)
		{
			$phrase = lang('Time.hours', [abs($hours)], $locale);
			$before = $hours < 0;
		}
		else if ($minutes !== 0)
		{
			$phrase = lang('Time.minutes', [abs($minutes)], $locale);
			$before = $minutes < 0;
		}
		else
		{
			return lang('Time.now', [], $locale);
		}

		return $before
			? lang('Time.ago', [$phrase], $locale)
			: lang('Time.inFuture', [$phrase], $locale);
	}
public function humanize ( string $ locale = null ) : string { $ current = clone ( $ this -> currentTime ) ; $ years = $ current -> fieldDifference ( $ this -> testTime , IntlCalendar :: FIELD_YEAR ) ; $ months = $ current -> fieldDifference ( $ this -> testTime , IntlCalendar :: FIELD_MONTH ) ; $ days = $ current -> fieldDifference ( $ this -> testTime , IntlCalendar :: FIELD_DAY_OF_YEAR ) ; $ hours = $ current -> fieldDifference ( $ this -> testTime , IntlCalendar :: FIELD_HOUR_OF_DAY ) ; $ minutes = $ current -> fieldDifference ( $ this -> testTime , IntlCalendar :: FIELD_MINUTE ) ; $ phrase = null ; if ( $ years !== 0 ) { $ phrase = lang ( 'Time.years' , [ abs ( $ years ) ] , $ locale ) ; $ before = $ years < 0 ; } else if ( $ months !== 0 ) { $ phrase = lang ( 'Time.months' , [ abs ( $ months ) ] , $ locale ) ; $ before = $ months < 0 ; } else if ( $ days !== 0 && ( abs ( $ days ) >= 7 ) ) { $ weeks = ceil ( $ days / 7 ) ; $ phrase = lang ( 'Time.weeks' , [ abs ( $ weeks ) ] , $ locale ) ; $ before = $ days < 0 ; } else if ( $ days !== 0 ) { $ phrase = lang ( 'Time.days' , [ abs ( $ days ) ] , $ locale ) ; $ before = $ days < 0 ; } else if ( $ hours !== 0 ) { $ phrase = lang ( 'Time.hours' , [ abs ( $ hours ) ] , $ locale ) ; $ before = $ hours < 0 ; } else if ( $ minutes !== 0 ) { $ phrase = lang ( 'Time.minutes' , [ abs ( $ minutes ) ] , $ locale ) ; $ before = $ minutes < 0 ; } else { return lang ( 'Time.now' , [ ] , $ locale ) ; } return $ before ? lang ( 'Time.ago' , [ $ phrase ] , $ locale ) : lang ( 'Time.inFuture' , [ $ phrase ] , $ locale ) ; }
Convert the time to human readable format

@param string|null $locale

@return string
Convert the time to human readable format