A two digit month could not be found Data missing 1

A two digit month could not be found Data missing

$dateInHuman = Carbon::parse($value)->diffForHumans();
return $dateInHuman;

Here is what the above code is Doing:
1. We’re using the Carbon library to parse the date.
2. We’re using the diffForHumans() method to get the difference between the date and the current date.
3. We’re returning the date in human readable format.

Now, we can use this custom attribute in our view like this:

{{ $post->created_at->diffForHumans() }}

Similar Posts