cakephp/chronos
Chronos provides immutable date/time objects for PHP, helping prevent accidental mutations and side effects. Includes ChronosDate for calendar dates fixed at 00:00:00, plus convenient APIs inspired by Carbon but no longer extending DateTime.
Added DST-safe elapsed time arithmetic methods that use Unix timestamp manipulation instead of wall clock time:
addElapsedHours() / subElapsedHours()addElapsedMinutes() / subElapsedMinutes()addElapsedSeconds() / subElapsedSeconds()These methods ensure correct behavior across DST transitions and are true inverses of diffInHours(), diffInMinutes(), and diffInSeconds().
Full Changelog: https://github.com/cakephp/chronos/compare/3.4.0...3.5.0
Full Changelog: https://github.com/cakephp/chronos/compare/3.3.3...3.4.0
Full Changelog: https://github.com/cakephp/chronos/compare/3.3.2...3.3.3
Full Changelog: https://github.com/cakephp/chronos/compare/3.3.1...3.3.2
Full Changelog: https://github.com/cakephp/chronos/compare/3.3.0...3.3.1
Full Changelog: https://github.com/cakephp/chronos/compare/3.2.0...3.3.0
Full Changelog: https://github.com/cakephp/chronos/compare/2.5.1...2.5.2
Full Changelog: https://github.com/cakephp/chronos/compare/3.1.0...3.2.0
This release requires PHP 8.4 to match the signature of DateTimeImmutable::createFromTimestamp(). Users not running PHP 8.4+ do not need this version.
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.5...2.5.1
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.4...2.4.5
Chronos::createFromTimestamp()handles timezones differently. If $timezone is not explicitly passed then the instance has timezone set to +00:00 unlike earlier where the currently set default timezone was used. This behavior change normalizes behavior with changes in PHP 8.4 which adds a new DateTimeInterface::createFromTimestamp() method.Full Changelog: https://github.com/cakephp/chronos/compare/3.0.4...3.1.0
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.3...2.4.4
Full Changelog: https://github.com/cakephp/chronos/compare/3.0.3...3.0.4
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.2...2.4.3
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.1...2.4.2
Full Changelog: https://github.com/cakephp/chronos/compare/3.0.2...3.0.3
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: https://github.com/cakephp/chronos/issues/410#issuecomment-1722185717
toDateTimeImmutable() by @othercorey in https://github.com/cakephp/chronos/pull/424 and https://github.com/cakephp/chronos/pull/427Full Changelog: https://github.com/cakephp/chronos/compare/3.0.1...3.0.2
Full Changelog: https://github.com/cakephp/chronos/compare/2.4.0...2.4.1
Full Changelog: https://github.com/cakephp/chronos/compare/3.0.0...3.0.1
Date was renamed to ChronosDate and will be dropped in 3.0MutableDate and MutableDateTime were deprecated and will be removed in 3.0Full Changelog: https://github.com/cakephp/chronos/compare/2.3.3...2.4.0
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.
Chronos and ChronosDate no longer extend DateTimeImmutable and no longer implement DateTimeInterfaceChronosInterface was dropped as Chronos and ChronosDate no longer extend the same base and don't try to share incompatible methods.MutableDateTime and MutableData were droppedChronosTime was added which supports parsing strings and conversion from Chronos and DateTimeInterfaceFull Changelog: https://github.com/cakephp/chronos/compare/3.0.0-beta2...3.0.0-beta3
Full Changelog: https://github.com/cakephp/chronos/compare/2.3.2...2.3.3
Full Changelog: https://github.com/cakephp/chronos/compare/3.0.0-beta1...3.0.0-beta2
Chronos 2.4.0 will be backwards compatible with the rest of Chronos 2.x. However, 2.4.0 will introduce deprecations to the mutable classes and many methods in preparation for the changes coming in Chronos 3. The upgrade guide has more information on the upcoming changes and how to update your application.
Chronos 2.4.0 will be backwards compatible with the rest of Chronos 2.x. However, 2.4.0 will introduce deprecations to the mutable classes and many methods in preparation for the changes coming in Chronos 3. The upgrade guide has more information on the upcoming changes and how to update your application.
Chronos 3.0 will be a major release that contains breaking changes. This beta release provides a preview release of what will be coming in the future and unblocks CakePHP 5.0 beta releases.
ChronosDate no longer implements DateTimeInterface and doesn't share types with Chronos either. This resolves a long standing interface compatibility issue where Date and DateTime objects appeared to be more type compatible than they should be.Chronos no longer implements DateTimeInterface or extends DateTimeImmutable. Instead Chronos is a wrapper around PHP's datetime, and continues to offer a similar interface to the PHP objects.In the future 2.4 will be released with deprecations to help with upgrading to chronos 3.x
Full Changelog: https://github.com/cakephp/chronos/compare/2.3.1...2.3.2
microsecond() setter.How can I help you explore Laravel packages today?