spatie / period

Complex period comparisons
https://spatie.be/open-source
MIT License
1.56k stars 72 forks source link

Allow a Period's precision to be changed #36

Closed jeromegamez closed 5 years ago

jeromegamez commented 5 years ago

Closes #18

The original goal was to define a precision when retrieving the length of a period.

By changing the Period's precision before getting its length, we don't need to change the signature of the length() method.

:octocat:

PS: This PR was created during Period::make('2019-04-29 19:00:00', '2019-04-29 20:23:00', Precision::MINUTE) in my first Twitch livestream, and I'm not capable of writing a better PR description right now 😅

jeromegamez commented 5 years ago

I don't know yet what it is, but there's a substantial flaw in the implementation. It seems to return what I want it to return, but I don't really understand why, and I can't wrap my head around it at the moment 🤔

jeromegamez commented 5 years ago

Something went very wrong here 😭. Streaming: success. Programming: fail.

While I do think that changing a periods's precision is the way to go, this is not it. I'll revisit this shortly (without anyone watching 😅) and create a valid PR.