3 namespace Drupal\datetime\Plugin\Validation\Constraint;
5 use Symfony\Component\Validator\Constraint;
8 * Validation constraint for DateTime items to ensure the format is correct.
11 * id = "DateTimeFormat",
12 * label = @Translation("Datetime format valid for datetime type.", context = "Validation"),
15 class DateTimeFormatConstraint extends Constraint {
18 * Message for when the value isn't a string.
22 public $badType = "The datetime value must be a string.";
25 * Message for when the value isn't in the proper format.
29 public $badFormat = "The datetime value '@value' is invalid for the format '@format'";
32 * Message for when the value did not parse properly.
36 public $badValue = "The datetime value '@value' did not parse properly for the format '@format'";