Change from y/m/d to m/d/y?

lmw1 20 Jan, 2011
The date format is confusing. The required format is (yyyy/mm/dd) we would like mm/dd/yyy. How can I change this?

Respectfully,
Len
GreyHead 21 Jan, 2011
Hi Len,

The validation code was originally borrowed from a Australian script. Seems they believe that the US format is confusing.

You can fix this by hacking the code code. Open up components/com_chronocontact/js/jsvalidation2.js and add the extra code block marked here at around line 162.
			if(field.hasClass('validate-date-au')){
				if( tmessage) { var message_validate_date_au = tmessage; }
				name.add( Validate.Format, {
					pattern: /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.](19|20)[0-9][0-9]$/,
					failureMessage: message_validate_date_au 
				});
				fieldsarray[fieldsarray_count] = name;
				fieldsarray_count = fieldsarray_count + 1;
			}
/* add the code snippet from here. . . */
			if(field.hasClass('validate-date-us')){
				if( tmessage) { var message_validate_date_us = tmessage; }
				name.add( Validate.Format, {
					pattern: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)[0-9][0-9]$/,
					failureMessage: message_validate_date_us 
				});
				fieldsarray[fieldsarray_count] = name;
				fieldsarray_count = fieldsarray_count + 1;
			}
/* . . . to here */ 
			if(field.hasClass('validate-currency-dollar')){


This will let you put the validate-date-us into an input class to validate a date as mm/dd/yyyy

Otherwise you could add a custom LiveValidation in the Form JavaScript box. I'm pretty sure that has been posted here before.

Bob
lmw1 26 Jan, 2011
This did not work. It's still telling people to enter their Date of Birth as yy/mm/day when it validates.

Any ideas?

Respectfully,
Len
Max_admin 27 Jan, 2011
Hi Len,

It should work, try to clear your browser and website caches ?

Cheers,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 30 Jan, 2011
Hi Len,

If the problem is just with the error message you can over-ride that in the title attribute of the input.

Bob
This topic is locked and no more replies can be posted.