Localised Date Format
-
Is there a way to change the date so it’s formatted as DD/MM/YY (or at least so it respects WordPress’s localisation setting)? If not, will that feature be added in the future?
-
You can Set Date format by this below method:
Plugin >> Editors >> Select Cf7 Advanced DatePicker >> jsThen in that change the format to DD/MM/YYYY
You can check jquery date formatting for the same.
Thanks
I changed it like as below in ‘ cf7-advanced-datepicker/js/custom-script.js’, but it appears to have no effect at all.
What am I doing wrong?
jQuery(document).ready(function($) { $('.cf7-adv-datepicker').datepicker({ autoclose: true, showAnim: setting.effect, changeMonth: setting.monyearmenu, changeYear: setting.monyearmenu, showWeek: setting.showWeek, minDate: setting.date, dateFormat: "yy-mm-dd" });This is the js code…there is no date format in there to change?
jQuery(document).ready(function($) {
$(‘.cf7-adv-datepicker’).datepicker({
autoclose: true,
showAnim: setting.effect,
changeMonth: setting.monyearmenu,
changeYear: setting.monyearmenu,
showWeek: setting.showWeek,
minDate: setting.date,
});
//verion 1.0 fail-safe
$(‘#cf7-adv-datepicker’).datepicker({
autoclose: true,
showAnim: setting.effect,
changeMonth: setting.monyearmenu,
changeYear: setting.monyearmenu,
showWeek: setting.showWeek,
minDate: setting.date,});
});
Yakaroo, I looked at the jQuery datepicker docs, and it seems by adding another parameter to each of those functions:
dateFormat: "yy-mm-dd"then it should set the date format. But it appears to have no effect.
I also tried adding this before the final closing brackets:
$( "#cf7-adv-datepicker" ).datepicker( "option", "dateFormat", "yy-mm-dd" );but again, no effect.
Ajit, any tips??
Hi mintynz,
dateFormat: ‘dd-mm-yy’
Can you try this where you have used dateFormat: “dd-mm-yy”?
Hi Ajit,
Thanks for the quick reply- I’m sorry to be slow myself, but I didn’t get a notification about your post!
That *** worked ***. I copied your text above, and now I have a date format that works for NZ. Many thanks!
—–
code that is working in “cf7-advanced-datepicker/js/custom-script.js” to give day/month/year formatted date:jQuery(document).ready(function($) { $('.cf7-adv-datepicker').datepicker({ dateFormat: 'dd-mm-yy', autoclose: true, showAnim: setting.effect, changeMonth: setting.monyearmenu, changeYear: setting.monyearmenu, showWeek: setting.showWeek, minDate: setting.date, }); //verion 1.0 fail-safe $('#cf7-adv-datepicker').datepicker({ dateFormat: 'dd-mm-yy', autoclose: true, showAnim: setting.effect, changeMonth: setting.monyearmenu, changeYear: setting.monyearmenu, showWeek: setting.showWeek, minDate: setting.date, });Ive made the changes suggested to the js file but still have the following problem:
The date appears in the format dd/mm/YYYY in the form, but in the email generated it is in the format mm/dd/YY
How can I get the email to be dd/mm/YYYY ?
Thanks
Fullej, does the date appear in the right format when it’s entered in the contact form, but not in the email? Or is it wrong in both?
Can you post your js code (as I have done above)?
Hi. |Thanks for the reply. Here is my code.
jQuery(document).ready(function($) { $('.cf7-adv-datepicker').datepicker({ dateFormat: 'dd-mm-yy', autoclose: true, showAnim: setting.effect, changeMonth: setting.monyearmenu, changeYear: setting.monyearmenu, showWeek: setting.showWeek, minDate: setting.date, }); //verion 1.0 fail-safe $('#cf7-adv-datepicker').datepicker({ dateFormat: 'dd-mm-yy', autoclose: true, showAnim: setting.effect, changeMonth: setting.monyearmenu, changeYear: setting.monyearmenu, showWeek: setting.showWeek, minDate: setting.date, }); });Hmm. Strange- that all looks right.
You can see my version working here:
http://visiqueoptometrist.co.nz/make-an-appointment/Is your contact form similar?
Just to confirm: does the date appear in the right format when it’s entered in YOUR contact form, but not in the email? Or is it wrong in both?
Cheers
MintyHi Minty,
Yes it works perfect in the front-end form, but is in the wrong format in the email generated.
See http://www.sharronbolton.co.uk/age-erased-face-lifting-serum/
(need to select “Collect from Salon” to see date field)John
Uh, when I go there and try to put in a date, it doesn’t pop up the datepicker calendar (compare with my link above).
Shouldn’t it do that if you’re using it as an ‘advanced datepicker’ field??
It seems to not work in IE, try Firefox or Chrome.
I’ll look at the IE problem
I was trying it with Firefox (Win 7.1, FF 38.01).
Well, all seems to be working for me now both with that and IE.
Datepicker puts in the right date. Just did a test submission- does the email look wrong?
The topic ‘Localised Date Format’ is closed to new replies.