Skip to content

Chronos 3.0.2

Compare
Choose a tag to compare
@markstory markstory released this 29 Sep 23:19
· 14 commits to 3.x since this release

Summary

The Chronos class once again extends DateTimeImmutable and therefore implements DateTimeInterface. ChronosDate and ChronosTime do not. Several parameters were expanded to allow DateTimeInterface instead of requiring only Chronos objects.

After making the original changes in 3.0.0, we realized that the supported PHP versions (8.1+) do not have the original bugs that made extending DateTimeImmutable either problematic or impossible in the future.

ChronosDate is intended to be a separate object and will not extend DateTimeImmutable as it supports mutating time and time zones which is hard to support.

ChronosTime was never meant to extend DateTimeImmutable and is part of the reason why ChronosInterface was removed as it doesn't represent a true shared interface.

An explanation of the reason behind the 3.0 changes can be found here: #410 (comment)

What's Changed

  • Change only Chronos to extend DateTimeImmutable once again by @othercorey in #417
  • Support creating Chronos from ChronosTime by @othercorey in #425
  • Allow passing DatePeriod options to diffFiltered() by @othercorey in #429
  • Allow setting time zone when converting to DateTimeImmutable by @othercorey in #430
  • Add halfOfYear, isFirstHalfOfYear, IsSecondHalfOfYear; improve getter… by @brenoroosevelt in #421
  • Add third Parameter $others to farthest and closest Methods by @brenoroosevelt in #422
  • Align Chronos::getTimezone() return type with DateTimeImmutable by @othercorey in #423
  • Add toDateTimeImmutable() by @othercorey in #424 and #427
  • Fix casting to string for ChronosDate and ChronosTime. by @ADmad in #428
  • Remove ChronosInterface references and clean up ChronosDate and ChronosTime refs by @othercorey in #431

New Contributors

Full Changelog: 3.0.1...3.0.2