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

Cater for both Carbon v2 and v3 - issue #260 #261

Merged
merged 3 commits into from
Jul 24, 2024

Conversation

specialtactics
Copy link
Member

@specialtactics specialtactics commented Jul 23, 2024

Carbon v3 deprecates the "diff real" functions, and throws a deprecated. It automatically routes the request to the function it thinks best, which in this case is diffInRealMinutes (see Carbon\Traits\Date::callDiffAlias() for details on why).

Since we are aiming to support both, I split the code into a conditional, calling the appropriate function. It also now returns a float, so it's necessary to cast round result to int - as it too will return a float.

I also added a test pipeline specifically for carbon 3, since nothing requires it specifically right now.

Description

Fixes #260

Checklist:

  • I've added tests for my changes or tests are not applicable
  • I've changed documentations or changes are not required
  • I've added my changes to CHANGELOG.md

@Messhias Messhias merged commit b163d51 into main Jul 24, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Carbon deprication: diffInRealMinutes -> diffInUTCMinute
2 participants