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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Carbon dependency, replace with DateTimeImmutable #47

Merged
merged 2 commits into from
Feb 3, 2024

Conversation

vicdelfant
Copy link
Contributor

With Carbon's long-awaited 3.0 release being out the door 馃帀, I discovered that the Oh Dear SDK was blocking the upgrade of one of our internal libraries because of its dependency on nesbot/carbon:^2.65.0.

As it turns out, however, Carbon is only being used by one method:

public function convertDateFormat(string $date, $format = 'YmdHis'): string
{
return Carbon::parse($date)->format($format);
}

With this in mind, it seemed more efficient to just use the native DateTimeImmutable instead of depending on an external library, especially with a new major release of it being out in the wild now.

This PR drops the dependency on Carbon and replaces it with a simple call to DateTimeImmutable::format(), while keeping green checks in the tests.

@freekmurze freekmurze merged commit baebf25 into ohdearapp:main Feb 3, 2024
4 checks passed
@freekmurze
Copy link
Contributor

Perfect, thank you!

@vicdelfant vicdelfant deleted the feature/carbon-to-datetime branch February 3, 2024 18:40
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.

None yet

2 participants