May 09, 2021 CoffeeScript
You need to find out the last day of the month, but there is no fixed schedule for each month of the year.
Use JavaScript's date overflow to find the first day of the month:
now = new Date
lastDayOfTheMonth = new Date(1900+now.getYear(), now.getMonth()+1, 0)
JavaScript's date constructor successfully handles overflows and underflows, making the calculation of dates simple. G iven this simple operation, there is no need to worry about how many days there are in a given month; In December, the above solution is to look for the date of the 0th day of the 13th month of the current year, then it is January 1 of the following year, and the date of December 31st of this year is calculated.