DatePicker::make("start_date")
->label(__("inputs.statistics-start-date"))
->hidden(function(Get $get){
if($get("time") === "all") return true;
})
->native(false)
->live()
->required(function(Get $get){
if($get("time") === "interval") return true;
})
->maxDate(function(Get $get, Set $set){
$endDate = $get('end_date');
if ($endDate) {
return Carbon::parse($endDate)->subDay();
}
return now();
})
,
DatePicker::make("end_date")
->label(__("inputs.statistics-end-date"))
->hidden(function(Get $get){
if($get("time") === "all") return true;
})
->required(function(Get $get){
if($get("time") === "interval") return true;
})
->live()
->minDate(function(Get $get, Set $set){
$startDate = $get('start_date');
if ($startDate) {
return Carbon::parse($startDate)->addDay();
}
return now();
})
->native(false)