I'm trying to archive month date 1 to month end date with.
below code now get this year month complete date 1 to 31 by below code. but it only gives current year month I want to pass dynamic year month name or month number to archive date list
$this->dateRange = CarbonPeriod::create(now()->startOfMonth(), now()->endOfMonth())->toArray();
dd($this->dateRange);
Result I get:
01-01-2024
02-01-2024
...
31-01-2024
I'm trying to archive month date 1 to month end date in array.
You can achive that using
->setMonth:}
But if you want to work with different years (instead of only the now() year), I recommend a different approach: