Reputation: 399
I have a problem, I pass a date in d / m / Y format to Vue from Laravel and I want to increase it by one month, but when I try to do:
From laravel send it as a JSON collection:
'date' => date ('d/m/Y', strtotime ($row->date)),
03/08/2020
In Vue:
let nextdate = new Date(date);
I get the day and the month reversed.
Sun Mar 08 2020 00:00:00 GMT-0500 (Peru standard time)
It should come out, August 3, 2020.
Upvotes: 0
Views: 609
Reputation: 2545
Try this
Carbon\Carbon::make($row->date)->setTimezone('America/Lima')->addMonth()->format('d/m/Y');
don't forget to double check your timezone America/Lima
you can find your timezone Here
Upvotes: 1