Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor time, date and strtotime function usage to Carbon #8695

Open
OA opened this issue Jun 26, 2024 · 0 comments
Open

Refactor time, date and strtotime function usage to Carbon #8695

OA opened this issue Jun 26, 2024 · 0 comments
Labels

Comments

@OA
Copy link

OA commented Jun 26, 2024

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()
@OA OA added the feature label Jun 26, 2024
@OA OA changed the title date and strtotime combinations to Carbon usage Refactor time, date and strtotime function usage to Carbon Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant