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

Carbon deprication: diffInRealMinutes -> diffInUTCMinute #260

Closed
zimonh opened this issue Jul 22, 2024 · 2 comments · Fixed by #261
Closed

Carbon deprication: diffInRealMinutes -> diffInUTCMinute #260

zimonh opened this issue Jul 22, 2024 · 2 comments · Fixed by #261
Assignees
Labels
bug Something isn't working

Comments

@zimonh
Copy link

zimonh commented Jul 22, 2024

Subject of the issue

I think in the latest version of Carbon: diffInRealMinutes is getting deprecated and this is now the preferred method: diffInUTCMinute:

They give this warning:

Use the method diffInUTCMinute instead to make it more explicit about what it does.
On next major version, "float" prefix will be removed (as all diff are now returning floating numbers) and "Real" methods will be removed in favor of "UTC" because what it actually does is to convert both dates to UTC timezone before comparison, while by default it does it only if both dates don't have exactly the same timezone (Note: 2 timezones with the same offset but different names are considered different as it's not safe to assume they will always have the same offset).

Steps to reproduce

using latest carbon version:
https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Traits/Date.php line:2756

Is it an option to switch to the diffInUTCMinute?

@zimonh zimonh added the bug Something isn't working label Jul 22, 2024
@specialtactics
Copy link
Member

Thanks for the report, it's an interesting one. I had a look at the code of both versions, and then the key is the function callDiffAlias() in \Carbon\Traits\Date, which gives a hint as top what should be used, which in this case is diffInMinutes

#261

@specialtactics specialtactics self-assigned this Jul 24, 2024
Messhias added a commit that referenced this issue Jul 24, 2024
…diffin-methods

Cater for both Carbon v2 and v3 - issue #260
@zimonh
Copy link
Author

zimonh commented Jul 24, 2024

thanks for the fast resolution ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants