Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Chronos Laravel Package

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.

View on GitHub
Deep Wiki
Context7
3.5.0

Improvements

  • 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

3.4.0

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/3.3.3...3.4.0

3.3.3

What's Changed

Bug Fixes

Full Changelog: https://github.com/cakephp/chronos/compare/3.3.2...3.3.3

3.3.2

What's Changed

Bug Fixes

Full Changelog: https://github.com/cakephp/chronos/compare/3.3.1...3.3.2

3.3.1

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/3.3.0...3.3.1

3.3.0

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/3.2.0...3.3.0

2.5.2

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/2.5.1...2.5.2

3.2.0

What's Changed

New Contributors

Full Changelog: https://github.com/cakephp/chronos/compare/3.1.0...3.2.0

2.5.1

This release requires PHP 8.4 to match the signature of DateTimeImmutable::createFromTimestamp(). Users not running PHP 8.4+ do not need this version.

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/2.4.5...2.5.1

2.4.5

What's Changed

New Contributors

Full Changelog: https://github.com/cakephp/chronos/compare/2.4.4...2.4.5

3.1.0

Behavior Changes

  • 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.

What's Changed

New Contributors

Full Changelog: https://github.com/cakephp/chronos/compare/3.0.4...3.1.0

2.4.4

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/2.4.3...2.4.4

3.0.4

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/3.0.3...3.0.4

2.4.3

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/2.4.2...2.4.3

2.4.2

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/2.4.1...2.4.2

3.0.3
3.0.2

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: https://github.com/cakephp/chronos/issues/410#issuecomment-1722185717

What's Changed

New Contributors

Full Changelog: https://github.com/cakephp/chronos/compare/3.0.1...3.0.2

2.4.1

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/2.4.0...2.4.1

3.0.1

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/3.0.0...3.0.1

2.4.0

Major Changes

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/2.3.3...2.4.0

3.0.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.

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
3.0.0-beta3

What's Changed

New Contributors

Full Changelog: https://github.com/cakephp/chronos/compare/3.0.0-beta2...3.0.0-beta3

2.3.3

What's Changed

New Contributors

Full Changelog: https://github.com/cakephp/chronos/compare/2.3.2...2.3.3

2.4.0-RC2

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.

2.4.0-RC1

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.

3.0.0-beta1

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.

Summary of Breaking changes

  • Removed Mutable datetime and date classes.
  • 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.
  • Removed Carbon compatibility shims. While chronos started out as a fork of Carbon due to lack of maintainship, the Carbon project has new maintainers and we no longer need to encroach on that namespace.

Upgrading

In the future 2.4 will be released with deprecations to help with upgrading to chronos 3.x

2.3.2

What's Changed

Full Changelog: https://github.com/cakephp/chronos/compare/2.3.1...2.3.2

2.3.1

What's Changed

  • Fix passing negative value to sub helpers such as subYears(-1) for PHP 8.2
2.3.0

Changes

  • Added missing microsecond() setter.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor