File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
6
6
7
+ ## [ 2.1.2] - 2018-04-21
8
+ ### Fixed
9
+ - Validation of dates
10
+
7
11
## [ 2.1.1] - 2018-04-20
8
12
### Fixed
9
13
- Forced choice value to be string when marking selected
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ public function __construct(array $args = array())
18
18
parent ::__construct ($ args );
19
19
}
20
20
21
+ public function isValidDate ($ date_original , $ date_created )
22
+ {
23
+ return $ date_created && $ date_created ->format ($ this ->format ) == '! ' . $ date_original ;
24
+ }
25
+
21
26
public function toNative ($ value )
22
27
{
23
28
if (empty ($ value )) {
@@ -26,7 +31,7 @@ public function toNative($value)
26
31
27
32
$ date = date_create_from_format ($ this ->format , $ value );
28
33
29
- if (!$ date ) {
34
+ if (!$ date || ! $ this -> isValidDate ( $ value , $ date ) ) {
30
35
throw new ValidationError ($ this ->error_messages ['invalid ' ], 'invalid ' );
31
36
}
32
37
You can’t perform that action at this time.
0 commit comments