Date.daysInMonth
Date.daysInMonth($date='now') -> number
Description
Return the number of days in the given month, accounting for leap years.
The $date argument can be a date string or Date object.
$jan = Date.create('2022-01-30')
Date.daysInMonth($jan)
//= 31
Date.daysInMonth('sep')
//= 30
Date.daysInMonth('Feb 2024')
//= 29 (leap year)
Date.daysInMonth('Feb 2021')
//= 28