1# Age
2
3- `v::age(int $minAge)`
4- `v::age(int $minAge, int $maxAge)`
5- `v::age(null, int $maxAge)`
6
7Validates ranges of years.
8
9The validated values can be any date value; internally they will be transformed
10into [DateTime](http://php.net/manual/en/class.datetime.php) objects according
11to the defined locale settings.
12
13The examples below validate if the given dates are lower or equal to 18 years ago:
14```php
15v::age(18)->validate('17 years ago'); // false
16v::age(18)->validate('18 years ago'); // true
17v::age(18)->validate('19 years ago'); // true
18v::age(18)->validate('1970-01-01'); // true
19v::age(18)->validate('today'); // false
20```
21
22The examples below validate if the given dates are between 10 and 50 years ago:
23```php
24v::age(10, 50)->validate('9 years ago'); // false
25v::age(10, 50)->validate('10 years ago'); // true
26v::age(10, 50)->validate('30 years ago'); // true
27v::age(10, 50)->validate('50 years ago'); // true
28v::age(10, 50)->validate('51 years ago'); // false
29```
30
31The examples below validate if the given dates are greater than or equal to 70 years ago:
32```php
33v::age(null, 70)->validate('today'); // true
34v::age(null, 70)->validate('70 years ago'); // true
35v::age(null, 70)->validate('71 years ago'); // false
36```
37
38Message template for this validator includes `{{minAge}}` and `{{maxAge}}`.
39
40***
41See also:
42
43  * [Between](Between.md)
44  * [Date](Date.md)
45  * [Max](Max.md)
46  * [Min](Min.md)
47