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

CarbonPeriod loses timezone when accessing days #3040

Closed
AEM5299 opened this issue Jun 19, 2024 · 0 comments · Fixed by #3041
Closed

CarbonPeriod loses timezone when accessing days #3040

AEM5299 opened this issue Jun 19, 2024 · 0 comments · Fixed by #3041
Labels
Milestone

Comments

@AEM5299
Copy link

AEM5299 commented Jun 19, 2024

Hello,

I encountered an issue with the following code:

echo CarbonPeriodImmutable::create('2024-01-01', '2024-01-05', CarbonTimeZone::create('Australia/Melbourne'))->first()->timezone

Carbon version: 3.3.1

PHP version: 8.2

I expected to get:

Australia/Melbourne

But I actually get:

UTC

In Carbon v2, the same code returns Australia/Melbourne as expected. I'm not sure if this is intended behaviour after the move to extend PHP's DatePeriod, but if it is I think it might need a callout in the upgrade guide.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants