Skip to content

Chronos 3.0.0

Compare
Choose a tag to compare
@othercorey othercorey released this 06 Aug 22:53
· 61 commits to 3.x since this release
414dbfb

Chronos 3 introduces some large changes driven by changes in PHP 8 (and expected change in PHP 9).

The biggest change is Chronos and ChronosDate no longer extend DateTimeImmutable which means they no longer implement DateTimeInterface. This will affect projects that use either of these as type declarations and pass in Chronos objects.

All of the relevant methods from DateTimeImmutable are still available on Chronos and ChronosDate. Some methods that were only relevant for Chronos were dropped from ChronosDate and so on.

If you need to pass a DateTimeImmutable or DateTimeInterface objects to a library, you can use the toNative() helper to get the equivalent DateTimeImmutable object.

Major Changes

  • Chronos and ChronosDate no longer extend DateTimeImmutable and no longer implement DateTimeInterface
  • ChronosInterface was dropped as Chronos and ChronosDate no longer extend the same base and don't try to share incompatible methods.
  • MutableDateTime and MutableData were dropped
  • ChronosTime was added which supports parsing strings and conversion from Chronos and DateTimeInterface