Assert that date is valid and corresponds to the given format.
public static date ( string $value, string $format, string | null $message = null, string | null $propertyPath = null ) : boolean | ||
$value | string | |
$format | string | supports all of the options date(), except for the following: N, w, W, t, L, o, B, a, A, g, h, I, O, P, Z, c, r. |
$message | string | null | |
$propertyPath | string | null | |
return | boolean |
protected function guardRequiredState() { parent::guardRequiredState(); Assertion::notNull($this->auth_token); Assertion::date($this->token_expire_date, DATE_ISO8601); }
protected function guardRequiredState() { Assertion::date($this->iso_date, self::DATE_ISO8601_WITH_MICROS); Assertion::uuid($this->uuid); Assertion::isArray($this->metadata); }
/** * @dataProvider invalidDateProvider */ public function testInvalidDate($value, $format) { $this->setExpectedException('Assert\\AssertionFailedException', null, Assertion::INVALID_DATE); Assertion::date($value, $format); }