socrates icon indicating copy to clipboard operation
socrates copied to clipboard

[v2.0.0] Remove Carbon dependency

Open AlexOlival opened this issue 4 years ago • 5 comments

As I'm working on the JS/TS/npm port, I'm striving to keep dependencies to a minimum - something that the npm ecosystem is plagued with.

However we ourselves are forcing a dependency on a DateTime wrapper library that, no matter how great it is, not all projects will use. PHP's DateTime class is fine and we should refactor our date handling to it, including Citizen's return type.

AlexOlival avatar Oct 08 '20 22:10 AlexOlival

An addendum: this will be a breaking change, so we're talking a major version here.

AlexOlival avatar Oct 09 '20 11:10 AlexOlival

Alternatively, we could deprecate the method returning the Carbon instance, and then later remove it altogether... Thoughts @JoaoFSCruz ?

AlexOlival avatar Oct 11 '20 11:10 AlexOlival

Currently we are using Carbon when manipulating dates in the extractors and to define the date of birth in the Citizen model. If we just deprecate the Citizen's method to return a DateTime instance instead of a Carbon instance we are not making that of a difference.

Maybe really push for the bigger change and totally lose Carbon. 🤷‍♂️

JoaoFSCruz avatar Oct 11 '20 17:10 JoaoFSCruz

Maybe really push for the bigger change and totally lose Carbon. man_shrugging

It would however mean that we could have a smoother transition to getting rid of Carbon without introducing a breaking change out of the blue. Something like v1.3.0 having a new getDateOfBirthNative() method alongside the old Carbon returning one, and then on v2.0, the original getDateOfBirth() would be rewritten to return a DateTime.

AlexOlival avatar Oct 12 '20 13:10 AlexOlival

I may have misunderstood 😅

When upgrading to a later version we can get rid of Carbon. But until then we can implement another method returning a DateTime instance for a smooth transition.

That sounds totally fine 👍

JoaoFSCruz avatar Oct 12 '20 18:10 JoaoFSCruz