#106681Allow relative dates in DateRangeValidator (and default value)
Description
I suggest also allowing relative date formats for the date fields in the form editor (DateRangeValidator and maybe also default value). This would make it possible, for example, to ensure that a date of birth can never have a value in the future or must be at least 18 years in the past. At the moment it is only possible to set an absolute date in the format Y-m-d.
The changes for the validator in PHP are IMHO quite simple. Just replace e.g. $minimum = \DateTime::createFromFormat($this->options['format'], $this->options['minimum']); with $minimum = date_create($this->options['minimum']);. Then the beforeRendering hook must be extended so that the attributes “min” and/or “max” are correctly filled. I already got these changes working in my dev setup. What I am still missing, however, is the adaptation of the propertyValidator. Currently, I have simply removed the existing one (“RFC3339FullDateOrEmpty”) to make it work…
I also didn’t have a look at required changes for the default value, as we don’t need relative formats there at the moment…
If you think this could be a useful addition, I could create a patch with my changes up to now.