I'm trying to figure out how to shorten the output from a diffForHumans
method provided by the Carbon library in laravel.
The default format of diffForHumans
is something like this:(from documentation)
When comparing a value in the past to default now:
5 months ago
1 hour ago
But I want the output to be something like:
- 1 h
- 5 mins
- 5 months
- 2 years
- Just Now
How can I achieve this?