A tinker for date difference
<?php
use Carbon\Carbon;
// if you accepting from request, you can use something like Carbon::parse(request('date_started'));
// for tinker purpose, I use Carbon::now();
$now = Carbon::now();
// If you accepting from request, you can use something like Carbon::parse(request('date_ended'));
$next_month = $now->copy()->addMonth();
// Get Different in Days
echo $now->diffInDays($next_month) . PHP_EOL;
// Get Different in Days, with negative value if it less than $now instance
echo $now->diffInDays($next_month, false) . PHP_EOL;
// Get Difference in Minutes
echo $now->diffInMinutes($next_month) . PHP_EOL;
// Get Difference in Minutes, with negative value if it less than $now instance
echo $now->diffInMinutes($next_month, false) . PHP_EOL;
/**
* The 2nd parameter again is optional and indicates if you want the return value to be the absolute value
* or a relative value that might have a - (negative) sign if the passed in date is less than the current instance.
*/