Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

DateTimeFormatConstraint.php

Namespace

Drupal\datetime\Plugin\Validation\Constraint

File

core/modules/datetime/src/Plugin/Validation/Constraint/DateTimeFormatConstraint.php

View source
<?php

namespace Drupal\datetime\Plugin\Validation\Constraint;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;

/**
 * Validation constraint for DateTime items to ensure the format is correct.
 */
class DateTimeFormatConstraint extends SymfonyConstraint {
    
    /**
     * Message for when the value isn't a string.
     *
     * @var string
     */
    public $badType = "The datetime value must be a string.";
    
    /**
     * Message for when the value isn't in the proper format.
     *
     * @var string
     */
    public $badFormat = "The datetime value '@value' is invalid for the format '@format'";
    
    /**
     * Message for when the value did not parse properly.
     *
     * @var string
     */
    public $badValue = "The datetime value '@value' did not parse properly for the format '@format'";

}

Classes

Title Deprecated Summary
DateTimeFormatConstraint Validation constraint for DateTime items to ensure the format is correct.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal