rector
rector copied to clipboard
Refactor time, date and strtotime function usage to Carbon
Feature Request
I'd like to see combinations of date and strtotime like the one in the first diff converted to use Carbon.
Always converting strtotime($invoice->getDate()) to something like Carbon::parse($invoice->getDate())->timestamp seems like a lot of overhead but this might be an idea too.
The same applies to calculations using unix timestamps as can be seen in the second diff.
Please let me know if this makes sense to you.
Diff
-date('d.m.Y', strtotime($invoice->getDate()))
+Carbon::parse($invoice->getDate())->format('d.m.Y')
-time() - (60 * 60 * 24 * 14)
+Carbon::now()->subWeek()