Date validation how to?

Hi,
i m not able to use the date validator, what are the validator parameters for dates like dd.mm.aaaa ?

thank you in advance

If the default date parsers don’t work for your date format you can use the regular expression validator. Here is how to use it for a date format: dd.mm.aaaa

On you metadata type configuration select the “Regular expression validator (arguments: pattern)”.

For arguments enter: pattern: (^0[1-9]|[12][0-9]|3[01])\.(0[1-9]|1[0-2])\.(\d{4}$)

This will only allow metadata that matches the regular expression pattern. This pattern is simple. If you need a more complete solution that verifies maximum month day including leap years, search for such an expression on the web.

Here is an untested example: Regex to validate date formats dd/mm/YYYY, dd-mm-YYYY, dd.mm.YYYY, dd mmm YYYY, dd-mmm-YYYY, dd/mmm/YYYY, dd.mmm.YYYY with Leap Year Support - Stack Overflow

Hi, thank you for the response, it works :wink:

1 Like