Skip to content

Commit 45ce5ba

Browse files
committed
feature #14284 [Validator] Document the invalidDateTimeMessage option (javiereguiluz)
This PR was merged into the master branch. Discussion ---------- [Validator] Document the invalidDateTimeMessage option Fixes #14280. Commits ------- 82880aa [Validator] Document the invalidDateTimeMessage option
2 parents 6aebe02 + 82880aa commit 45ce5ba

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

reference/constraints/Range.rst

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Validates that a given number or ``DateTime`` object is *between* some minimum a
66
========== ===================================================================
77
Applies to :ref:`property or method <validation-property-target>`
88
Options - `groups`_
9+
- `invalidDateTimeMessage`_
910
- `invalidMessage`_
1011
- `max`_
1112
- `maxMessage`_
@@ -316,13 +317,33 @@ Options
316317

317318
.. include:: /reference/constraints/_groups-option.rst.inc
318319

320+
invalidDateTimeMessage
321+
~~~~~~~~~~~~~~~~~~~~~~
322+
323+
**type**: ``string`` **default**: ``This value should be a valid number.``
324+
325+
.. versionadded:: 5.2
326+
327+
The ``invalidDateTimeMessage`` option was introduced in Symfony 5.2.
328+
329+
The message displayed when the ``min`` and ``max`` values are PHP datetimes but
330+
the given value is not.
331+
332+
You can use the following parameters in this message:
333+
334+
=============== ==============================================================
335+
Parameter Description
336+
=============== ==============================================================
337+
``{{ value }}`` The current (invalid) value
338+
=============== ==============================================================
339+
319340
invalidMessage
320341
~~~~~~~~~~~~~~
321342

322343
**type**: ``string`` **default**: ``This value should be a valid number.``
323344

324-
The message that will be shown if the underlying value is not a number (per
325-
the :phpfunction:`is_numeric` PHP function).
345+
The message displayed when the ``min`` and ``max`` values are numeric (per
346+
the :phpfunction:`is_numeric` PHP function) but the given value is not.
326347

327348
You can use the following parameters in this message:
328349

0 commit comments

Comments
 (0)