Home / Admin / Using Date Picker Localization
Duplicate Snippet

Embed Snippet on Your Site

Using Date Picker Localization

This snippet is used to apply the changes that instruct WPForms to update the date picker locale

<10
Code Preview
php
<?php
/**
 * Apply the date picker locale strings.
 *
 * @link https://wpforms.com/developers/localize-the-date-picker-strings/
 */
 
function wpf_dev_datepicker_apply_locale() {
    ?>
 
    <script type="text/javascript">
    jQuery( document ).ready( function() {
 
        jQuery( '.wpforms-datepicker-wrap' ).each( function() {
            var calendar = this._flatpickr;
 
            if ( 'object' === typeof calendar ) {
                calendar.set( 'locale', 'es' );
            }
 
        } );
 
    } );
 
    </script>
 
    <?php
}
 
add_action( 'wpforms_wp_footer_end', 'wpf_dev_datepicker_apply_locale', 10 );

Comments

Add a Comment