Plugin Elementor: How to equip the datepicker with german date?

First you need to download and install the plugin “Elementor Datepicker Localization” from https://github.com/creame/elementor-datepicker-localization and then add the following code to functions.php.

// Beispiel, Umstellung auf 'de' Sprache
add_filter( 'elementor/datepicker/locale', function(){ return 'de'; } );

// Beispiel, ändern Sie das Datumsformat in j F, Y
add_filter( 'elementor/datepicker/format', function(){ return 'j F, Y'; } );

// Beispiel, verwenden Sie das 24-Stunden-Format für die Zeiteingabe
add_filter( 'elementor/datepicker/24h', '__return_true' );

Alternative without Plugin:

add_action('wp_footer', function () {
    ?>
    <script>
    function waitForFlatpicker(callback) {
        if (typeof window.flatpickr !== 'function') {
            setTimeout(function () {
                waitForFlatpicker(callback);
            }, 100);
        } else {
            callback();
        }
    }
    waitForFlatpicker(function () {
        flatpickr.l10ns.pt = {
            weekdays: {
                shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
                longhand: [
                    "Sonntag",
                    "Montag",
                    "Dienstag",
                    "Mittwoch",
                    "Donnerstag",
                    "Freitag",
                    "Samstag",
                ],
            },
            months: {
                shorthand: [
                    "Jan",
                    "Feb",
                    "Mar",
                    "Apr",
                    "Mai",
                    "Jun",
                    "Jul",
                    "Aug",
                    "Sep",
                    "Okt",
                    "Nov",
                    "Dez",
                ],
                longhand: [
                    "Januar",
                    "Februar",
                    "März",
                    "April",
                    "Mai",
                    "Juni",
                    "Juli",
                    "August",
                    "September",
                    "Oktober",
                    "November",
                    "Dezember",
                ],
            },
            rangeSeparator: " até ",
        };
        flatpickr.localize(flatpickr.l10ns.pt);
        flatpickr('.flatpickr-input');
    });
    </script>
    <?php
});

 

Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.