Skip to content

DateTimeRangeValidator not usable caused by DateFormat validation or incorrect translation format type  #3323

Closed
@andigehle

Description

When using the DateTimeRangeValidator and submitting a form with such an date which is invalid, the following error messages are used: (See the placeholder definition in lower case "datetime")

<source>The given date must be between {0,datetime,datetime} and {1,datetime,datetime}</source>
</trans-unit>
<trans-unit id="1324315107" xml:space="preserve">
<source>The given date must be after {0,datetime,datetime}</source>
</trans-unit>
<trans-unit id="1324315115" xml:space="preserve">
<source>The given date must be before {0,datetime,datetime}</source>

The translation string like {1, datetime, datetime} goes through the DateTimeFormatter and validates by DateReader::validateFormatType

public static function validateFormatType(string $formatType): void

The validation here checks hard on camelcase value "dateTime" and so the translation placeholder "datetime" throws an error to be not a valid format.

Exception: Provided formatType, "datetime", is not one of allowed values.
Trace:
Neos\Flow\I18n\Cldr\Reader\DatesReader_Original::validateFormatType("datetime")
Neos\Flow\I18n\Formatter\DatetimeFormatter_Original::format(DateTime, Neos\Flow\I18n\Locale, array|1|)
Neos\Flow\I18n\FormatResolver_Original::resolvePlaceholders("The given date must be after {0,datetime,datetime}", array|1|, Neos\Flow\I18n\Locale)

Possible solution:

  • Change the placeholder string in all translation files for DateTimeRange from "datetime" to "dateTime"

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions