20 lines
436 B
PHP
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];
|
|
}
|
|
}
|