Skip to content

ChronosDate::modify() fails on 'second' relative keywords #532

Description

@quentin-happiso

Description

Calling modify() on a ChronosDate instance with relative expressions such as 'second monday of this month' throws an error.

Steps to Reproduce

use Cake\Chronos\ChronosDate;

$date = (new ChronosDate('2026-09-01'))->modify('second monday of this month');

Expected Behavior

The ChronosDate instance is modified to the second Monday of the month.

Actual Behavior

Throws an exception:

Cannot modify date objects by time values

Environment

  • cakephp/chronos: 3.5.1
  • PHP: 8.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions