( date: DateArg<DateType>, options?: LastDayOfISOWeekYearOptions<ResultDate> | undefined, )
| 36 | * //=> Sun Jan 01 2006 00:00:00 |
| 37 | */ |
| 38 | export function lastDayOfISOWeekYear< |
| 39 | DateType extends Date, |
| 40 | ResultDate extends Date = DateType, |
| 41 | >( |
| 42 | date: DateArg<DateType>, |
| 43 | options?: LastDayOfISOWeekYearOptions<ResultDate> | undefined, |
| 44 | ): ResultDate { |
| 45 | const year = getISOWeekYear(date, options); |
| 46 | const fourthOfJanuary = constructFrom(options?.in || date, 0); |
| 47 | fourthOfJanuary.setFullYear(year + 1, 0, 4); |
| 48 | fourthOfJanuary.setHours(0, 0, 0, 0); |
| 49 | |
| 50 | const date_ = startOfISOWeek(fourthOfJanuary, options); |
| 51 | date_.setDate(date_.getDate() - 1); |
| 52 | return date_; |
| 53 | } |
no test coverage detected