Create a new file dates.js and add the following code. To execute this code run the command node dates.js from your terminal. You can use this function to get first and last days dates in a given month. I tested this on node 12
const getDays = () => { const date = new Date(); const year = date.getFullYear(); let month = date.getMonth() + 1; let f = new Date(year, month, 1).getDate(); let l = new Date(year, month, 0).getDate(); f = f < 10 ? '0'+f : f; l = l < 10 ? '0'+l : l; month = month < 10 ? '0'+month : month; const firstDay = new Date(`${year}-${month}-${f}`); const lastDay = new Date(`${year}-${month}-${l}`); console.log({"firstDay": firstDay,"lastDay": lastDay });};getDays();