lib/apis/distraction/spotlight.js
function () {
        return new Promise(function (resolve, reject) {
            var rotations = [];
            for (var i = 0; i < spotlightRotations.length; i++) {
                var now = new Date();
                var daysToAdd = 3 * i;
                now.setDate(now.getDate() + daysToAdd);

                var currentSpotlight = Math.floor((((Math.floor((now / 1000) / (24 * 60 * 60))) - 49) % (3 * spotlightRotations.length)) / 3);
                var daysUntilNext = (3 - ((Math.floor((now / 1000) / (24 * 60 * 60))) - 49) % (3 * spotlightRotations.length) % 3) + daysToAdd;
                var start = new Date();
                start.setDate(start.getDate() + (daysUntilNext - 3));

                var obj = {
                    rotation: spotlightRotations[currentSpotlight],
                    daysUntilNext: daysUntilNext,
                    startDate: start
                };
                rotations.push(obj);
            }
            resolve(rotations);
        });
    }
function () {
        return new Promise(function (resolve, reject) {
            var rotations = [];
            for (var i = 0; i < spotlightRotations.length; i++) {
                var now = new Date();
                var daysToAdd = 3 * i;
                now.setDate(now.getDate() + daysToAdd);

                var currentSpotlight = Math.floor((((Math.floor((now / 1000) / (24 * 60 * 60))) - 49) % (3 * spotlightRotations.length)) / 3);
                var daysUntilNext = (3 - ((Math.floor((now / 1000) / (24 * 60 * 60))) - 49) % (3 * spotlightRotations.length) % 3) + daysToAdd;
                var start = new Date();
                start.setDate(start.getDate() + (daysUntilNext - 3));

                var obj = {
                    rotation: spotlightRotations[currentSpotlight],
                    daysUntilNext: daysUntilNext,
                    startDate: start
                };
                rotations.push(obj);
            }
            resolve(rotations);
        });
    }
function ( ) { return new Promise ( function ( resolve , reject ) { var rotations = [ ] ; for ( var i = 0 ; i < spotlightRotations . length ; i ++ ) { var now = new Date ( ) ; var daysToAdd = 3 * i ; now . setDate ( now . getDate ( ) + daysToAdd ) ; var currentSpotlight = Math . floor ( ( ( ( Math . floor ( ( now / 1000 ) / ( 24 * 60 * 60 ) ) ) - 49 ) % ( 3 * spotlightRotations . length ) ) / 3 ) ; var daysUntilNext = ( 3 - ( ( Math . floor ( ( now / 1000 ) / ( 24 * 60 * 60 ) ) ) - 49 ) % ( 3 * spotlightRotations . length ) % 3 ) + daysToAdd ; var start = new Date ( ) ; start . setDate ( start . getDate ( ) + ( daysUntilNext - 3 ) ) ; var obj = { rotation : spotlightRotations [ currentSpotlight ] , daysUntilNext : daysUntilNext , startDate : start } ; rotations . push ( obj ) ; } resolve ( rotations ) ; } ) ; }
Gets upcoming rotations
Gets upcoming rotations