Created
January 12, 2020 21:33
-
-
Save zilahir/97fe2c9fd30e0863c84729c17be189b6 to your computer and use it in GitHub Desktop.
get all day iin a month
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
const d = new Date() | |
const currentYear = d.getFullYear() | |
const months = Array(12).fill().map((e,i) => i) | |
// console.debug('currentYear', currentYear) | |
// console.debug(months) | |
const getDaysInMonth = (month, year) => (new Array(31)).fill('').map((v,i)=>new Date(year,month-1,i+1)).filter(v=>v.getMonth()===month-1) | |
console.debug(getDaysInMonth(1, currentYear)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment