You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My application uses the Range constraint to validate against relative date ranges like this:
#[Assert\Range(
notInRangeMessage: 'Date out of range: Must not be older than 40 days and not in the future',
min: '-40 days',
max: 'now',
)]
When testing the application, I'd love to leverage Symfony's clock to pin the current date to a fixture. However, the RangeValidator as well as comparison validators like GreaterThanValidator and friends are not aware of the clock.
Simply making them aware of the clock won't solve the problem because we would suddenly need to distinguish between absolute date strings like 'March 1st 2025' and relative ones like '2 days ago'.
Example
No response
The text was updated successfully, but these errors were encountered:
Description
My application uses the
Range
constraint to validate against relative date ranges like this:When testing the application, I'd love to leverage Symfony's clock to pin the current date to a fixture. However, the
RangeValidator
as well as comparison validators likeGreaterThanValidator
and friends are not aware of the clock.Simply making them aware of the clock won't solve the problem because we would suddenly need to distinguish between absolute date strings like
'March 1st 2025'
and relative ones like'2 days ago'
.Example
No response
The text was updated successfully, but these errors were encountered: