(
date: DateArg<Date> & {},
options?: GetDaysInMonthOptions | undefined,
)
| 26 | * //=> 29 |
| 27 | */ |
| 28 | export function getDaysInMonth( |
| 29 | date: DateArg<Date> & {}, |
| 30 | options?: GetDaysInMonthOptions | undefined, |
| 31 | ): number { |
| 32 | const _date = toDate(date, options?.in); |
| 33 | const year = _date.getFullYear(); |
| 34 | const monthIndex = _date.getMonth(); |
| 35 | const lastDayOfMonth = constructFrom(_date, 0); |
| 36 | lastDayOfMonth.setFullYear(year, monthIndex + 1, 0); |
| 37 | lastDayOfMonth.setHours(0, 0, 0, 0); |
| 38 | return lastDayOfMonth.getDate(); |
| 39 | } |
no test coverage detected