Class DifferenceFormatter
Handles formatting differences in text.
Provides a swappable component for other libraries to leverage. when localizing or customizing the difference output.
Namespace: Cake\Chronos
Property Summary
-
$translate protected
Cake\Chronos\Translator
The text translator object
Method Summary
-
__construct() public
Constructor.
-
diffForHumans() public
Get the difference in a human readable format.
Method Detail
__construct() ¶ public
__construct(Cake\Chronos\Translator|null $translate = null)
Constructor.
Parameters
-
Cake\Chronos\Translator|null
$translate optional The text translator object.
diffForHumans() ¶ public
diffForHumans(Cake\Chronos\ChronosDateDateTimeInterface $first, Cake\Chronos\ChronosDateDateTimeInterface|null $second = null, bool $absolute = false): string
Get the difference in a human readable format.
Parameters
-
Cake\Chronos\ChronosDateDateTimeInterface
$first -
Cake\Chronos\ChronosDateDateTimeInterface|null
$second optional -
bool
$absolute optional
Returns
string