Files
expense/app/Helpers/PeriodeHelper.php
T
2025-05-05 19:40:38 +07:00

20 lines
436 B
PHP

<?php
namespace App\Helpers;
use Illuminate\Support\Carbon;
class PeriodeHelper
{
public static function getPeriodeRange($month, $year)
{
$month = (int) date('m', strtotime($month));
$year = (int) $year;
// Jika Januari, periode dimulai dari 11 Januari hingga 10 Februari
$start = Carbon::create($year, $month, 11)->startOfDay();
$end = $start->copy()->addMonth()->subDay()->endOfDay();
return [$start, $end];
}
}