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

Allow setting time zone when converting to DateTimeImmutable #430

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

othercorey
Copy link
Member

Allow users to set the time zone when converting to DateTimeImmutable instead of only defaulting to the internal implementation.

Users will probably use this when converting between systems and will need flexibility.

This adds no extra overhead to the conversion.

@othercorey othercorey added this to the 3.x milestone Sep 25, 2023
@@ -176,9 +176,15 @@ public function testToW3cString()
public function testToDateTimeImmutable(): void
{
$d = ChronosDate::now();
$this->assertSame($d->format('Y-m-d'), $d->toDateTimeImmutable()->format('Y-m-d'));
$this->assertSame($d->format('Y-m-d H:i:s.u'), $d->toDateTimeImmutable()->format('Y-m-d H:i:s.u'));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extend the test to ensure the time isn't warped.

@markstory markstory merged commit 034be85 into 3.x Sep 29, 2023
7 checks passed
@markstory markstory deleted the to-native-timezone branch September 29, 2023 00:46
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.

2 participants