Set active tab according to date in visual composer wordpress

Solution:

I created the following function which switches visual composer tabs by ID.

var setVCTab = function(name) {

    var $id = "#"+name; 
    if ($($id).length > 0) {

        setTimeout(function() {

            // Clear tabs
            $(".vc_tta-tab").each(function(i,a) {
                $(a).removeClass("vc_active");
            });


            // Clear panels
            $(".vc_tta-panels").children().each(function() {
                $(this).removeClass("vc_active");
            });


            // Activate Tabs
            $(".vc_tta-tabs-list a[href="+$id+"]").each(
                function(i,a) { var tab = $(a).closest(".vc_tta-tab"); if (tab) tab.addClass("vc_active");}
            );

            // Activate Panel
            $($id).addClass("vc_active");

            location.href = $id;

        },1);
    }

};

Therefore it should be possible for you to do something like the following.

// Map day indices to tab IDs
var days =["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];

// Activate tab for day
setVCTab(days[(new Date()).getDay()]);