bootstrap_calendar icon indicating copy to clipboard operation
bootstrap_calendar copied to clipboard

Starting day of the week

Open goztrk opened this issue 11 years ago • 3 comments

There isn't an option for changing starting day of weeks. In some countries Monday is the first day of the week. So It must be iterate the day according to that.

goztrk avatar Jan 30 '14 09:01 goztrk

have a look at the project the boostrap calendar is forked from https://github.com/bichotll/bic_calendar - it's starting day is monday, not sunday. that was one of the reasons i created this fork, as an english translation. but you're probably correct, that is an option i should look into adding as a configuration option.

xero avatar Jan 31 '14 14:01 xero

Solved!

        // Modify the related function
        function calculateWeekday(day,month,year){
            var dateObj = new Date(year, month, day);
            var numDay = dateObj.getDay();
            /* EMR */
            numDay -= startWeekDay;
            if(numDay == -1)
                numDay = 6;
             /* END EMR */
            return numDay;
        }

        // Initialize the param
        /* EMR */
        var startWeekDay = 0; // Default: sunday
        if (typeof args.startWeekDay != 'undefined')
            startWeekDay = args.startWeekDay;
        /* END EMR */

        // Use it in your main
        startWeekDay: 1,

emr1985 avatar Sep 16 '14 09:09 emr1985

:+1:

szantogeri avatar Feb 05 '15 23:02 szantogeri