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.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
55and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
66
7+ ## [ 2.1.2] - 2018-04-21
8+ ### Fixed
9+ - Validation of dates
10+
711## [ 2.1.1] - 2018-04-20
812### Fixed
913 - 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())
1818 parent ::__construct ($ args );
1919 }
2020
21+ public function isValidDate ($ date_original , $ date_created )
22+ {
23+ return $ date_created && $ date_created ->format ($ this ->format ) == '! ' . $ date_original ;
24+ }
25+
2126 public function toNative ($ value )
2227 {
2328 if (empty ($ value )) {
@@ -26,7 +31,7 @@ public function toNative($value)
2631
2732 $ date = date_create_from_format ($ this ->format , $ value );
2833
29- if (!$ date ) {
34+ if (!$ date || ! $ this -> isValidDate ( $ value , $ date ) ) {
3035 throw new ValidationError ($ this ->error_messages ['invalid ' ], 'invalid ' );
3136 }
3237
You can’t perform that action at this time.
0 commit comments