mirror of
https://github.com/Respect/Validation.git
synced 2024-06-13 19:22:16 +02:00
2f12b6c8d8
Although the name is much longer, it's more explicit what it does. I confess that after a while without using Validation, even I get confused about that. Besides, I would like to create another rule with the same name, but that will behave differently. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
1.1 KiB
1.1 KiB
MinAge
MinAge(int $age)
MinAge(int $age, string $format)
Validates a minimum age for a given date. The $format
argument should be in
accordance to PHP's date() function. When $format
is not given this rule
accepts Supported Date and Time Formats by PHP (see strtotime()).
v::minAge(18)->validate('18 years ago'); // true
v::minAge(18, 'Y-m-d')->validate('1987-01-01'); // true
v::minAge(18)->validate('17 years ago'); // false
v::minAge(18, 'Y-m-d')->validate('2010-09-07'); // false
Using Date before is a best-practice. This rule does not accepts instances of DateTimeInterface.
Categorization
- Date and Time
Changelog
Version | Description |
---|---|
0.3.9 | Created |
See also: