how do I get diff between two dates in minutes, but excluding the weekend (Saturday & Sunday)
<?php
require_once __DIR__ . '/autoload.php';
use Carbon\Carbon;
use Carbon\CarbonInterval;
$created = Carbon::parse("2021-04-11 00:07:13");
$firstResponse = Carbon::parse("2021-04-12 12:35:04");
$diffInMinutes = $created->diffFiltered(CarbonInterval::minute(), function($date){
return !$date->isWeekend();
}, $firstResponse);
echo $diffInMinutes;
The error message was Carbon error: Could not find next valid date
Can anyone please help me? thank you.