GitHub 6248★

Get the number of days in given month

JavaScript version

// `month` is zero-based index
const daysInMonth = (month, year) => new Date(year, month, 0).getDate();

TypeScript version

const daysInMonth = (month: number, year: number): number => new Date(year, month, 0).getDate();
Follow me on and to get more useful contents.