Kan være et problem relateret til konverteringen af input prøv at bruge en str_to_date og literal Where(brug en korrekt datoformatkonvertering baseret på dit format, da mit eksempel er "%d-%m-%Y")
$modelStockDetails=StockDetails::find()
->where(' date(created) between STR_TO_DATE("'. $start_date . '", "%d-%m-%Y" )
AND STR_TO_DATE("' . $end_date . '", "%d-%m-%Y" )' )
->andwhere(['receiving_order_id' =>$modelRecevingOrder->id,'deleted' => 'N'])->all();
eller for at undgå brugen af var i sql kan du bruge
$modelStockDetails=StockDetails::find()
->where(' date(created) between STR_TO_DATE(:start_date, "%d-%m-%Y" )
AND STR_TO_DATE( :end_date, "%d-%m-%Y" )', [':start_date' => $start_date, ':end_date' => $end_date] )
->andwhere(['receiving_order_id' =>$modelRecevingOrder->id,'deleted' => 'N'])->all();