This package shows date time or human readable time. You can adjust the exact time when the package shows the date time instead the human readable time.
Human readable time example:
$datetime = \Carbon\Carbon::parse('2021-05-05 10:30:00')->subMinutes(15);
<x:human-readable-time :datetime="$datetime" />
Output:
<!-- Output -->
<time datetime="2021-05-05 10:15:00">15 minutes before</time>
Date time example:
$datetime = \Carbon\Carbon::parse('2021-05-05 10:30:00')->subMinutes(90);
<x:human-readable-time :datetime="$datetime" />
Output:
<!-- Output -->
<time datetime="2021-05-05 09:00:00">2021-05-05 09:00:00</time>
You can adjust the time when the date time is displayed. The default time is 1 hour.
$datetime = \Carbon\Carbon::parse('2021-05-05 10:30:00')->subMinutes(120);
<x:human-readable-time :datetime="$datetime" human-until="-3 hours" />
Output:
<!-- Output -->
<time datetime="2021-05-05 09:00:00">2 hour before</time>
- Laravel 9.x or Laravel 10.x
- PHP 8.x
You can install the package via composer:
composer require poldixd/human-readable-time
composer test
Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.