Hey there, Awesome Customers!

Just a heads up: We'll be taking a breather to celebrate International Workers' Day (May 1st and 2nd - Wednesday and Thursday) and Orthodox Easter from Good Friday (May 3rd) through Easter Monday (May 6th). So, from May 1st to May 6th, our team will be off enjoying some well-deserved downtime.

During this time, our customer support will be running on a smaller crew, but don't worry! We'll still be around to help with any urgent matters, though it might take us a bit longer than usual to get back to you.

We'll be back in action at full throttle on May 7th (Tuesday), ready to tackle your questions and requests with gusto!

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find loads of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel). These gems might just have the answers you're looking for while we're kicking back.

Thanks a bunch for your understanding and support!

Catch you on the flip side!

Warm regards,

TMS

Okay
  Public Ticket #1355651
Modify first day of the week (date picker)
Closed

Comments

  •  5
    Jottes started the conversation

    Hi,

    how can I modify the date picker to display monday as the first day of the week (instead of sunday)? I have set this in wordpress but wpDataTables ignores this setting.

    Thank you

  •  471
    Isidora replied

    Hi Johannes,

    This is not possible to achieve with the plugin build in and it require some modification. I can give you a guide where to look. First you will need to have this file from the link.

    This is example for German format

    Then go to ../wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.funcs.js around line 148 you will find this code:

     $(this).datetimepicker(
        { format: wdtDateFormat,
          showClear: true,
          keepOpen: true,
          useCurrent: false
          }
    

    If you use moment.js the you need to load moment-with-locales.min.js not moment.min.js. Otherwise, your locale: 'de' will not work.

    Then the code should look like this 

     $(this).datetimepicker(
        { format: wdtDateFormat,
          showClear: true,
          keepOpen: true,
          useCurrent: false,
          locale: 'de'
    }

    Also you have to change  in file:

    wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.frontend.min.js

    It's a minified so you must search for 

    $(this).datetimepicker({format:wdtDateFormat,showClear:!0,keepOpen:!0,useCurrent:!1})

    and change the code

    $(this).datetimepicker({format:wdtDateFormat,showClear:!0,keepOpen:!0,useCurrent:!1,locale:'de'})

    This is temporary solution, so after next update this changes will be overwritten so you have to come back and do it again.


    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Hi Milan,

    thank you for the fast reply.

    I modified the files but I didn't quite understand the part with the file from the link. Where do I have to include it?

  •  5
    Jottes replied

    I changed the files back because the date picker wasn't displayed any more

  •  471
    Isidora replied

    Hi Johannes,

    You have to include that file form local on page.You have to add code in file 

    wp-content/plugins/wpdatatables/source/class.wdttools.php around line 778

    wp_enqueue_script('wdt-moment', WDT_JS_PATH . 'moment/moment.js', array(), false, true);
    

    and add this under the moment.js

    wp_enqueue_script('wdt-moment', WDT_JS_PATH . 'moment/locale/de.js', array(), false, true);

    Also you have to add this code in file under the comments "Apply datetimepicker" in  file

    wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.funcs.js around line 149

    moment.lang('de', {    
    week : {        dow : 1 // Monday is the first day of the week    
    }
    });


    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Thank you, Milan.

    The first day of the week is now changed.

    The language file isn't being used, however. Deleting the browser cache didn't help. Did I implement this right in the wdt.frontend.min.js?

    function(){$(this).datetimepicker({format:wdtDateFormat,showClear:!0,locale:'de'}).off('dp.show')

    This only works if I switch the "minified wpDataTables Javascript" on in the JS settings, right? If I do so, the datepicker isn't being displayed any more at all. Also, I need to switch if off because of this: https://tmsplugins.ticksy.com/ticket/1343736/

    If you have any other idea, please let me know.

  •  471
    Isidora replied

    Hi Johannes,

    You have to find this for datetimepicker and add locale:

    $('body').on('focus','.wdt-datetimepicker',function(){$(this).datetimepicker({format:wdtDateFormat+' '+wdtTimeFormat,showClear:!0,keepOpen:!0,useCurrent:!1}

    There is three lines of code like this and they are differ by class for datepicker, timepicker and datetimepicker(you can see for datetimepicker class is .wdt-datetimepicker)

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Hi Milan,

    I've changed all three lines but they look a bit different from what you wrote. I'll attach the file so you can have a look.

  •  471
    Isidora replied

    Hi Johannes,

    We find solution for this. Replace this in file

    wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.funcs.js around line 149

    moment.lang('de', {    
    week : {        dow : 1 // Monday is the first day of the week    }
    });

    with this code.

    moment.lang('de', {    
    weekdaysMin : ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],    
    week : {        dow : 1 // Monday is the first day of the week    }
    });

    Also you have to change  in file:

    wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.frontend.min.js

    It's a minified so you must search for 

    $('body').on('focus','.wdt-datepicker',function()
    

    and insert code before this.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Hi Milan,

    I just updated wpDataTables and went through the whole process again. Here's what I did:

    1. File: wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.frontend.min.js

    search for

    $(this).datetimepicker({format:wdtDateFormat,showClear:!0,keepOpen:!0,useCurrent:!1})

    and change the code to

    $(this).datetimepicker({format:wdtDateFormat,showClear:!0,keepOpen:!0,useCurrent:!1,locale:'de'})

    Do this three times for '.wdt-datepicker', '.wdt-datetimepicker' and '.wdt-timepicker'.


    2. Add this code in file under the comments "Apply datetimepicker" in  file

    wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.funcs.js around line 149

    moment.lang('de', {    
    weekdaysMin : ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],   
    week : {        dow : 1 //
    Monday is the first day of the week    }
    }});

    So the code looks like this (not sure if this step is correct):

        /**
         * Apply datetimepicker
         */
        // Datepicker
        $('body').on('focus', '.wdt-datepicker', function () {
            $(this).datetimepicker(
                {
                    format: wdtDateFormat,
                    showClear: true,
                    keepOpen: true,
                    useCurrent: false,
                    locale: 'de'
                }
            )
                .off('dp.show')
                .on('dp.show', function () {
                    $(this).parent().find('div.bootstrap-datetimepicker-widget').addClass('wdt-datetimepicker-modal');
                    wdtAddTodayPlaceholder($(this));
                })
                moment.lang('de', {    
                    weekdaysMin : ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
                    week : {        dow : 1 // Monday is the first day of the week
                }});
        });


    3. Add code in file

    wp-content/plugins/wpdatatables/source/class.wdttools.php around line 778 search for:

    wp_enqueue_script('wdt-moment', WDT_JS_PATH . 'moment/moment.js', array(), false, true);

    and add this underneath that line:

    wp_enqueue_script('wdt-moment', WDT_JS_PATH . 'moment/locale/de.js', array(), false, true);

    The result is that I have Monday as the first day of the week but not the days and months in German language. This is also what it was like in version 2.0.

    What am I missing?

    Regards, Jottes

  •  471
    Isidora replied

    Hi Johanes,
    Thank you for your purchase.

    Yes like i wrote in previous post, you have to add moment.lang in file under the comments "Apply datetimepicker" , not in datepicker function.

       
        /**
         * Apply datetimepicker
         */
        moment.lang('de', {    
                    weekdaysMin : ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
                    week : {        dow : 1 // Monday is the first day of the week
        }});
        // Datepicker
        $('body').on('focus', '.wdt-datepicker', function () {
            $(this).datetimepicker(
                {
                    format: wdtDateFormat,
                    showClear: true,
                    keepOpen: true,
                    useCurrent: false,
                    locale: 'de'
                }
            )
                .off('dp.show')
                .on('dp.show', function () {
                    $(this).parent().find('div.bootstrap-datetimepicker-widget').addClass('wdt-datetimepicker-modal');
                    wdtAddTodayPlaceholder($(this));
                })
                
        });


    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Hi Milan,

    thank you for the quick reply and the hint. I changed the file accordingly, but still I get the English day values (see attachment).

    Any other idea?

    Johannes

  •  471
    Isidora replied

    Hi Johanes,

    Also you have to change  in file:

    wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.frontend.min.js

    It's a minified so you must search for 

    $('body').on('focus','.wdt-datepicker',function()

    and insert code before this.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Hi Milan,

    what code do I have to insert?

    This?

    moment.lang('de', {    
    weekdaysMin : ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],    
    week : {        dow : 1 // Monday is the first day of the week    }
    });

    Regards

  •  471
    Isidora replied

    Hi Johanes,

    Yes I mean on that code.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Hi Milan,

    I changed the file wdt.frontend.min.js and added the code before the function. It looks like this now:

    [...] moment.lang('de', { weekdaysMin : ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], week : { dow : 1 }});$('body').on('focus','.wdt-datepicker',function() [...]

    The days are still displayed in English, however.

    This might be because I need to have the button "use minified version of js files" switched off due to this ticket

  •  5
    Jottes replied

    If I change the switch, it's working. At least for the days, not for the months yet.

    Can I only do this via the minified js files? Is there no way to have minified js files switched off and still use German date values?

  •  471
    Isidora replied

    Hi Johanes,

    Yes you can turn off option "Use minified wpDataTables Javascript"  on tab CUSTOM JS AND CSS in settings of plugin.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Hi Milan,

    this didn't answer my question.

    If I switch if off, the changes will not apply because I was changing a minified JS file. But I have to have it switched off.

    So how can I change the date settings to German without using minified JS files?

  •  471
    Isidora replied

    Hi Johanes,

    Like i describe you down below, you have to make all changes that i suggest in file wdt.funcs.js. If you turn off option  "Use minified wpDataTables Javascript" , minified js file will not be include on page so you don't have to make changes in minified file wdt.frontend.min.js.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Hi Milan,

    right, so I did change the wdt.funcs.js to this and switched off the minified JS files a few days ago already:

    /**
         * Apply datetimepicker
         */
        moment.lang('de', {    
                    weekdaysMin : ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
                    week : {        dow : 1 // Monday is the first day of the week
        }});
        // Datepicker
        $('body').on('focus', '.wdt-datepicker', function () {
            $(this).datetimepicker(
                {
                    format: wdtDateFormat,
                    showClear: true,
                    keepOpen: true,
                    useCurrent: false,
                    locale: 'de'
                }
            )
                .off('dp.show')
                .on('dp.show', function () {
                    $(this).parent().find('div.bootstrap-datetimepicker-widget').addClass('wdt-datetimepicker-modal');
                    wdtAddTodayPlaceholder($(this));
                })
                
        });

    But it's still in English

  •  471
    Isidora replied

    Hi Johanes,

    We found that moment extension for language is deprecated, so this is solution for you to translate datepicker and datetimepicker on German language.

    Add this code in file under the comments "Apply datetimepicker" in  file

    wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.funcs.js around line 149

    moment.locale('de', {
            months : ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],
            weekdaysMin : ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
            week : {        dow : 1 // Monday is the first day of the week
            }});

    Then go to ../wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.funcs.js around line 148 you will find this code for datepicker:

     $(this).datetimepicker(
        { format: wdtDateFormat,
          showClear: true,
          keepOpen: true,
          useCurrent: false
          }

    Then the code should look like this 

     $(this).datetimepicker(
        {
          format: wdtDateFormat,
          showClear: true,
          keepOpen: true,
          useCurrent: false,
          locale: 'de'
    }

    Then go to ../wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.funcs.js around line 181 you will find this code for datetimepicker:

            $(this).datetimepicker(
                {
                    format: wdtDateFormat + ' ' + wdtTimeFormat,
                    showClear: true,
                    keepOpen: true,
                    useCurrent: false
                   
                }

    Then the code should look like this 

            $(this).datetimepicker(
                {
                    format: wdtDateFormat + ' ' + wdtTimeFormat,
                    showClear: true,
                    keepOpen: true,
                    useCurrent: false,
                    locale: 'de'
                }
     

    If you include locale/de.js already you don't have again, but we must explain in detail so there is no mistake.You have to include that file form local on page.You have to add code in file 

    wp-content/plugins/wpdatatables/source/class.wdttools.php around line 778

    wp_enqueue_script('wdt-moment', WDT_JS_PATH . 'moment/moment.js', array(), false, true);
    

    and add this under the moment.js

    wp_enqueue_script('wdt-moment', WDT_JS_PATH . 'moment/locale/de.js', array(), false, true);
    

    When you finish this you don't have to insert code in minified files is you turn off option "Use minified wpDataTables Javascript"  on tab CUSTOM JS AND CSS in settings of plugin.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  5
    Jottes replied

    Thank you for the detailed explanation - looks like this worked now. :-)