Skip to content

Instantly share code, notes, and snippets.

@zilahir
Created January 12, 2020 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zilahir/97fe2c9fd30e0863c84729c17be189b6 to your computer and use it in GitHub Desktop.
Save zilahir/97fe2c9fd30e0863c84729c17be189b6 to your computer and use it in GitHub Desktop.
get all day iin a month
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