21
21
* @category Zend
22
22
* @package Zend_Validate
23
23
*/
24
- class DateStep extends AbstractValidator
24
+ class DateStep extends Date
25
25
{
26
- const INVALID = 'dateStepInvalid ' ;
27
- const INVALID_DATE = 'dateStepInvalidDate ' ;
28
26
const NOT_STEP = 'dateStepNotStep ' ;
29
27
30
28
/**
31
29
* @var array
32
30
*/
33
31
protected $ messageTemplates = array (
34
- self ::INVALID => "Invalid type given. String, integer, array or DateTime expected " ,
35
- self ::INVALID_DATE => "The input does not appear to be a valid date " ,
36
32
self ::NOT_STEP => "The input is not a valid step "
37
33
);
38
34
@@ -155,28 +151,6 @@ public function getStep()
155
151
return $ this ->step ;
156
152
}
157
153
158
- /**
159
- * Returns the format option
160
- *
161
- * @return string
162
- */
163
- public function getFormat ()
164
- {
165
- return $ this ->format ;
166
- }
167
-
168
- /**
169
- * Sets the format option
170
- *
171
- * @param string $format
172
- * @return DateStep
173
- */
174
- public function setFormat ($ format )
175
- {
176
- $ this ->format = $ format ;
177
- return $ this ;
178
- }
179
-
180
154
/**
181
155
* Returns the timezone option
182
156
*
@@ -241,13 +215,7 @@ protected function convertToDateTime($param)
241
215
*/
242
216
public function isValid ($ value )
243
217
{
244
- if (!is_string ($ value )
245
- && !is_int ($ value )
246
- && !($ value instanceof DateTime)
247
- ) {
248
- $ this ->error (self ::INVALID );
249
- return false ;
250
- }
218
+ parent ::isValid ($ value );
251
219
252
220
$ this ->setValue ($ value );
253
221
@@ -258,7 +226,6 @@ public function isValid($value)
258
226
try {
259
227
$ valueDate = $ this ->convertToDateTime ($ value );
260
228
} catch (Exception \InvalidArgumentException $ ex ) {
261
- $ this ->error (self ::INVALID_DATE );
262
229
return false ;
263
230
}
264
231
0 commit comments