diff --git a/src/Forms/DateField.php b/src/Forms/DateField.php index 9d698e012..8ed22d84c 100644 --- a/src/Forms/DateField.php +++ b/src/Forms/DateField.php @@ -7,6 +7,7 @@ use SilverStripe\i18n\i18n; use InvalidArgumentException; use SilverStripe\ORM\FieldType\DBDate; use SilverStripe\ORM\FieldType\DBDatetime; +use SilverStripe\ORM\ValidationResult; /** * Form used for editing a date stirng @@ -403,8 +404,16 @@ class DateField extends TextField _t( 'DateField.VALIDDATEMINDATE', "Your date has to be newer or matching the minimum allowed date ({date})", - ['date' => $this->internalToFrontend($min)] - ) + [ + 'date' => sprintf( + '', + $min, + $this->internalToFrontend($min) + ) + ] + ), + ValidationResult::TYPE_ERROR, + ValidationResult::CAST_HTML ); return false; } @@ -420,8 +429,16 @@ class DateField extends TextField _t( 'DateField.VALIDDATEMAXDATE', "Your date has to be older or matching the maximum allowed date ({date})", - ['date' => $this->internalToFrontend($max)] - ) + [ + 'date' => sprintf( + '', + $max, + $this->internalToFrontend($max) + ) + ] + ), + ValidationResult::TYPE_ERROR, + ValidationResult::CAST_HTML ); return false; } diff --git a/src/Forms/DatetimeField.php b/src/Forms/DatetimeField.php index 7a7ff97fd..02295b319 100644 --- a/src/Forms/DatetimeField.php +++ b/src/Forms/DatetimeField.php @@ -6,6 +6,7 @@ use IntlDateFormatter; use InvalidArgumentException; use SilverStripe\i18n\i18n; use SilverStripe\ORM\FieldType\DBDatetime; +use SilverStripe\ORM\ValidationResult; /** * Form field used for editing date time strings. @@ -586,8 +587,16 @@ class DatetimeField extends TextField _t( 'DatetimeField.VALIDDATETIMEMINDATE', "Your date has to be newer or matching the minimum allowed date and time ({datetime})", - ['datetime' => $this->internalToFrontend($min)] - ) + [ + 'datetime' => sprintf( + '', + $min, + $this->internalToFrontend($min) + ) + ] + ), + ValidationResult::TYPE_ERROR, + ValidationResult::CAST_HTML ); return false; } @@ -603,8 +612,16 @@ class DatetimeField extends TextField _t( 'DatetimeField.VALIDDATEMAXDATETIME', "Your date has to be older or matching the maximum allowed date and time ({datetime})", - ['datetime' => $this->internalToFrontend($max)] - ) + [ + 'datetime' => sprintf( + '', + $max, + $this->internalToFrontend($max) + ) + ] + ), + ValidationResult::TYPE_ERROR, + ValidationResult::CAST_HTML ); return false; }