Definition at line 33 of file Date.php.
◆ __construct()
__construct |
( |
|
$options = array() | ) |
|
Sets validator options
- Parameters
-
Definition at line 76 of file Date.php.
82 $temp[
'format'] = array_shift(
$options);
84 $temp[
'locale'] = array_shift(
$options);
90 if (array_key_exists(
'format',
$options)) {
94 if (!array_key_exists(
'locale',
$options)) {
95 #require_once 'Zend/Registry.php'; 101 if (array_key_exists(
'locale',
$options)) {
static isRegistered($index)
◆ getFormat()
Returns the locale option
- Returns
- string|null
Definition at line 134 of file Date.php.
◆ getLocale()
Returns the locale option
- Returns
- string|Zend_Locale|null
Definition at line 111 of file Date.php.
◆ isValid()
Defined by Zend_Validate_Interface
Returns true if $value is a valid date of the format YYYY-MM-DD If optional $format or $locale is set the date format is checked according to Zend_Date, see Zend_Date::isDate()
- Parameters
-
- Returns
- boolean
Implements Zend_Validate_Interface.
Definition at line 161 of file Date.php.
165 $this->
_error(self::INVALID);
171 if (($this->_format !==
null) || ($this->_locale !==
null) || is_array(
$value) ||
173 #require_once 'Zend/Date.php'; 174 if (!Zend_Date::isDate(
$value, $this->_format, $this->_locale)) {
175 if ($this->_checkFormat(
$value) ===
false) {
176 $this->
_error(self::FALSEFORMAT);
178 $this->
_error(self::INVALID_DATE);
183 if (!preg_match(
'/^\d{4}-\d{2}-\d{2}$/',
$value)) {
184 $this->_format =
'yyyy-MM-dd';
185 $this->
_error(self::FALSEFORMAT);
186 $this->_format =
null;
190 list($year, $month, $day) = sscanf(
$value,
'%d-%d-%d');
192 if (!checkdate($month, $day, $year)) {
193 $this->
_error(self::INVALID_DATE);
_error($messageKey, $value=null)
◆ setFormat()
setFormat |
( |
|
$format = null | ) |
|
◆ setLocale()
setLocale |
( |
|
$locale = null | ) |
|
Sets the locale option
- Parameters
-
- Returns
- Zend_Validate_Date provides a fluent interface
Definition at line 122 of file Date.php.
124 #require_once 'Zend/Locale.php'; static findLocale($locale=null)
◆ $_format
◆ $_locale
◆ $_messageTemplates
Initial value:= array(
self::INVALID => "Invalid type given. String, integer, array or Zend_Date expected",
self::INVALID_DATE => "'%value%' does not appear to be a valid date",
self::FALSEFORMAT => "'%value%' does not fit the date format '%format%'",
)
Definition at line 44 of file Date.php.
◆ $_messageVariables
Initial value:= array(
'format' => '_format'
)
Definition at line 53 of file Date.php.
◆ FALSEFORMAT
const FALSEFORMAT = 'dateFalseFormat' |
◆ INVALID
const INVALID = 'dateInvalid' |
◆ INVALID_DATE
const INVALID_DATE = 'dateInvalidDate' |
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Validate/Date.php