( date: DateArg<DateType>, options?: LastDayOfMonthOptions<ResultDate> | undefined, )
| 31 | * //=> Tue Sep 30 2014 00:00:00 |
| 32 | */ |
| 33 | export function lastDayOfMonth< |
| 34 | DateType extends Date, |
| 35 | ResultDate extends Date = DateType, |
| 36 | >( |
| 37 | date: DateArg<DateType>, |
| 38 | options?: LastDayOfMonthOptions<ResultDate> | undefined, |
| 39 | ): ResultDate { |
| 40 | const _date = toDate(date, options?.in); |
| 41 | const month = _date.getMonth(); |
| 42 | _date.setFullYear(_date.getFullYear(), month + 1, 0); |
| 43 | _date.setHours(0, 0, 0, 0); |
| 44 | return toDate(_date, options?.in) as ResultDate; |
| 45 | } |
no test coverage detected