Navin Bista
Navin Bista

Reputation: 2128

Jquery countdown timer for week days only

I am using Syotimer jquery plugin(https://github.com/mrfratello/SyoTimer) for recursive countdown. It is working fine.Currently I have set it to peroidic countdown for 2 days.

Here is my code:

jQuery('#periodic_timer').syotimer({
                year: 2016,
                month: 1,
                day: 30,
                hour: 13,
                minute: 41,


                dayVisible: false,
                dubleNumbers: false,
               // effectType: 'opacity',

                periodUnit: 'd',
                periodic: true,
                periodInterval: 2,
            });

Now my problem is i need to set the timer on only week day and on weekend the timer should not work? Can anyone help me on this? Does this plugin provide such feature or is there any possible way that i can achieve my requirement?

Regards, aton1004

Upvotes: 2

Views: 847

Answers (1)

John Syomochkin
John Syomochkin

Reputation: 51

Your functionality not necessarily include in the plugin. You can determine the current day of the week and then, if it is not weekend, just connect the plugin:

var currentDateTime = new Date(),
    currentWeekDay = currentDateTime.getDay();

if ( currentWeekDay != 0 && currentWeekDay != 6 ) {
    var syoTimerOptions = {
        // put here plugin options
        };
    jQuery('#periodic_timer').syotimer( syoTimerOptions );
}

P.S.: Method getDate() returns number of week day: 0 - Sunday, 1 - Monday, ..., 6 - Saturday

Upvotes: 1

Related Questions