( date: DateArg<DateType>, options?: StartOfQuarterOptions<ResultDate> | undefined, )
| 31 | * //=> Tue Jul 01 2014 00:00:00 |
| 32 | */ |
| 33 | export function startOfQuarter< |
| 34 | DateType extends Date, |
| 35 | ResultDate extends Date = DateType, |
| 36 | >( |
| 37 | date: DateArg<DateType>, |
| 38 | options?: StartOfQuarterOptions<ResultDate> | undefined, |
| 39 | ): ResultDate { |
| 40 | const _date = toDate(date, options?.in); |
| 41 | const currentMonth = _date.getMonth(); |
| 42 | const month = currentMonth - (currentMonth % 3); |
| 43 | _date.setMonth(month, 1); |
| 44 | _date.setHours(0, 0, 0, 0); |
| 45 | return _date; |
| 46 | } |
no test coverage detected