Created
September 2, 2022 11:01
-
-
Save Shaxadhere/d76035f8cebe4d829215dacfa09541a8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function getDayNames(from, to) { | |
var d = new Date(from), | |
to = new Date(to), | |
a = [], | |
y = [ | |
"Sunday", | |
"Monday", | |
"Tuesday", | |
"Wednesday", | |
"Thursday", | |
"Friday", | |
"Saturday", | |
]; | |
while (d < to) { | |
console.log(d.getDay()); | |
a.push(y[d.getDay()]); | |
d.setDate(d.getDate() + 1); | |
} | |
if (d.getDay() === to.getDay()) a.push(y[d.getDay()]); | |
console.log(a); | |
a = a.filter((item, i, ar) => ar.indexOf(item) === i); | |
return a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment