Date (Validation Rule) - Help
This is an open discussion with 10 replies, filed under Troubleshooting.
Search
Is there any reason why you aren’t using the Date Field for this purpose?
Yes, there is. Here in Brazil we use the date like this: day/month/year
When I type for example 01/02/2010 (February 1st) it reads like: January 2nd. There’s any way to change it?
When you first install Symphony you can choose your Locale settings and the Date field, AFAIK, will display dates however you have specified.
By the sounds of it you’ve already installed Symphony, so you can change them manually in the config.php
file found in your manifest
folder.
The region
array holds the information for displaying the time & date format, and your timezone. The formats are directly from the PHP Date manual and the PHP Timezone reference.
Thanks brendo, it works now!
Anyway, for futher needs, there’s some reference anywhere for the Regular Expressions of Symphony?
Expressões Regulares - Guia de Consulta Rápida (Portuguese)
Edit: Symphony does not have any specific regexp rules. It’s just the old and good regular expressions.
So Rainer, any tip for why that expression on my first post didn’t work?
Actually it works, you just forgot to put the slashes.
/^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)[0-9]{2}$/
I forgot to mention that you need to escape slashes and dots. See more here.
/^(0[1-9]|[12][0-9]|3[01])[- \/\.](0[1-9]|1[012])[- \/\.](19|20)[0-9]{2}$/
Now it should work.
Now it works perfectly Rainer. Thanks a lot!
Create an account or sign in to comment.
Hi guys,
Can anyone help me with the regular expressions in Symphony? I’m trying to set a validation rule for a date Text Input, and it’s not working.
I need the system to check if the user typed the following format: dd/MM/yyyy
I tried this:
But didn’t work.
What’s the right rules for the regex?
tia!