I'm using Laravel for one of my project. Everything is just fine, but I can't solve a strange error.
- I'm sending duration in years from my front end (Vuejs).
- If client is on any active plan then plan start should be the current plan end date else set to now().
- Add years in start time and set as plan end.
Now when I do this in actual code, I see same start and end date generated according to plan end.
$start = Carbon::parse($client->plan_end) ?: Carbon::now();
$end = $start->addYears($request->planDetails['duration']);
return response([
'start' => $start,
'end' => $end,
]);
This is plan_end timestamp in database -- 2022-05-09 09:15:19
This is response I receive.
{
"start" : "2024-05-09T07:15:19.000000Z",
"end" : "2024-05-09T07:15:19.000000Z"
}