Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #455088

    I had a client who was confused with the default DD / MM / YY format of the date in the datepicker of the contact form element in Enfold.

    I saw this thread that mentioned making a customization to class-form-generator.php:

    The post said I could use that with a child theme. I have edited class-form-generator.php so that every reference of dd / mm / yy is now mm / dd / yy, and I uploaded that new file to childtheme/framework/php

    But the date in the datepicker is still dd / mm / yy.

    What else do I need to do?

    Thanks in advance for your help. You guys are great!

    #455089

    Hey AJDesignCo!

    Please add following code to Functions.php file in Appearance > Editor

    add_filter('avf_datepicker_date_placeholder', 'new_date_placeholder');
    function new_date_placeholder() {
    $placeholder = "MM / DD / YY";
    return $placeholder;
    }

    Regards,
    Yigit

    #455091

    Thanks for the quick reply Yigit!

    I added that, but it’s not quite working. This is a screenshot of functions.php in my child theme Editor:
    Editor screenshot

    This is the page with the contact form that includes a datepicker:
    http://wc.ajdesignco.com/dinner-reservations/

    The initial display of the datepicker is correct: MM / DD / YY

    But when the user uses the datepicker to select a date like June 12, 2015, the value that is displayed after clicking the date is 12 / 06 / 2015 (and to most North American users, that is December 6, 2015).

    Is there something else I need to do? If what I’m asking isn’t feasible, please let me know and I’ll handle it with a plugin.

    Thank you!

    #455494

    Hi!

    Please use this code instead:

    add_filter( 'avf_datepicker_dateformat', function(){ return 'mm / dd / yy'; } );
    add_filter( 'avf_datepicker_date_placeholder', function(){ return 'MM / DD / YY'; } );

    Best regards,
    Ismael

    #456303

    Thank you for the revision. It worked perfectly! And I have it added in the functions.php of my child theme, so future parent theme updates won’t disturb it. I appreciate the support!

    #456462

    Hi!

    Great, glad we could help!

    Regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘MM / DD / YY order in Datepicker’ is closed to new replies.