Created
August 27, 2013 07:33
-
-
Save adrianthedev/6350690 to your computer and use it in GitHub Desktop.
order days array to start with current day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var weekdays = new Array('Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sambata', 'Duminica'); | |
function startDay(days){ | |
var d = new Date(); | |
var n = d.getDay()-1; | |
var weekDays = new Array(); | |
var t = n; | |
for (var i = 0; i < days.length; i++) { | |
if(t < days.length){ | |
weekDays[i] = days[i+n]; | |
}else{ | |
weekDays[i] = days[t-days.length]; | |
} | |
t++; | |
}; | |
return weekDays; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment