ChronosDate::modify() fails on 'second' relative keywords
Open
Beginner friendly
Nobody has claimed this yet.
bug
- Dominant language
- PHP
- Stars
- 1.4k
- Forks
- 71
- Avg merge
- 1d 59m
- Merged PRs (30d)
- 2
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ChronosDate::modify() with the reproducing expression 'second monday of this month'. Check why this relative keyword is treated as a time value, then add a regression test covering the provided date and expression. Done means the call returns the second Monday without raising the time-value exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100